Android RTL语言环境.如何仅在支持语言环境时镜像?

Axi*_*xus 1 android locale right-to-left

我有一个支持希伯来语的应用程序,并在清单中声明它对RTL语言环境的支持.但是,还有其他RTL语言环境我不支持,并希望View在设置这些语言环境时不会镜像我的镜像.例如,我不希望我的应用程序View在阿拉伯语语言环境中从右向左交换,因为我不支持阿拉伯语,因此文本将以英语显示.

xso*_*soh 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>
Run Code Online (Sandbox Code Playgroud)

然后values/strings.xml补充:

<string name="is_hebrew">false</string>
Run Code Online (Sandbox Code Playgroud)

values-he/strings.xml添加:

<string name="is_hebrew">true</string>
Run Code Online (Sandbox Code Playgroud)