2017-06-23 2 views
0

Est-il possible de changer une image en fonction de la sélection de la langue du mobile?Modifier l'image en fonction de la sélection de la langue

Ceci est le code que j'utilise en XML, ce que je veux, c'est qu'il y a un moyen que quand il est dans une langue, l'image change dans la langue correspondante parce qu'il y a du texte dans les images.

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

    <ImageView 
     android:layout_width="360dp" 
     android:layout_centerHorizontal="true" 
     android:layout_height="wrap_content" 
     android:src="@drawable/calculate_wavelength_stepversion" 
     android:id="@+id/imageExample"/> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="@string/desarrollo" 
     android:layout_marginRight="10dp" 
     android:layout_below="@+id/imageExample" 
     android:layout_marginLeft="10dp" 
     android:layout_marginTop="10dp" /> 


    </RelativeLayout> 

</FrameLayout> 
+0

Je ne suis pas trop sûr de ce que vous avez besoin, mais essayez ce lien sur: https://developer.android.com/training/basics/supporting-devices/languages.html –

Répondre

2

Oui vous pouvez créer comme ça, res/drawable-en-rCA/ou res/drawable-fr-rCA /, vous pouvez consulter AliasResources et this

0

Utilisez une certaine logique dans votre classe java, Lorsque vous détectez un changement de langue, définissez le contenu de l'image sur un autre dessin.