2017-06-23 152 views
0

根据移动设备的语言选择,是否可以更改imageView?根据语言选择更改图片

这是我在xml中使用的代码,我想要的是,如果有某种方式,当它处于特定语言时,图像将更改为相应的语言,因为在图像中输入了文本。

<?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

我不太清楚你需要什么,但试试这个链接:https://developer.android.com/training/basics/supporting-devices/languages.html –

回答

2

是的,你可以创建这样的,RES /绘制-ZH-RCA /或RES /绘制-FR-RCA /,你可以参考AliasResourcesthis

0

使用一些逻辑在你的java类,当您检测到某种语言更改时,将图像的内容设置为不同的绘图。