我有一个支持希伯来语的应用程序,并在清单中声明它对RTL语言环境的支持。但是,我不支持其他RTL语言环境,并希望在设置这些语言环境时不镜像我的View
。例如,我不希望我的应用程序的View
在阿拉伯语语言环境中从右向左交换,因为我不支持阿拉伯语,因此文本将以英语显示。
答案 0 :(得分:6)
我想最好的方法是根据语言选择android:supportsRtl
值。为此,请参阅以下内容:
<强>的AndroidManifest.xml 强>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:supportsRtl="@string/is_hebrew" >...</application>
然后在values/strings.xml
添加:
<string name="is_hebrew">false</string>
使用values-he/strings.xml
添加:
<string name="is_hebrew">true</string>
答案 1 :(得分:3)
您可以选择在运行时打开或关闭镜像。见https://stackoverflow.com/a/17683045/192373。限制为4.2或更高,仅限于活动的onCreate()。