Android 阿拉伯语资源本地化

Android Localization for resources arabic language

我想将图片本地化为阿拉伯语?我该如何完成这个任务?

我关注了Localization and drawables,但运气不好。

您可以添加新的 android 资源文件夹

可绘制资源的本地化与字符串资源相同。您需要创建 drawable-ar 文件夹并将图像放入该文件夹。

或者,如果您的图像位于 drawable-mdpi 之类的任何文件夹中,则 drawable-ar-mdpi

阅读详情documentation here

不要忘记,一旦您将 strings.xml 添加到阿拉伯语的资源文件中,请确保您的布局已准备好支持 RTL。

在您的清单文件中:

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme"
    android:supportsRtl="true" > ....

并且在所有布局文件中,确保添加了 left/right 和 start/end 组合。来自 Google Blog:

Change all of your app's "left/right" layout properties to new "start/end" equivalents.

If you are targeting your app to Android 4.2 (the app's targetSdkVersion or minSdkVersion is 17 or higher), then you should use “start” and “end” instead of “left” and “right”. For example, android:paddingLeft should become android:paddingStart.

If you want your app to work with versions earlier than Android 4.2 (the app's targetSdkVersion or minSdkVersion is 16 or less), then you should add “start” and end” in addition to “left” and “right”. For example, you’d use both android:paddingLeft and android:paddingStart.

一旦完成,就很容易对其进行测试。要么将您的语言更改为阿拉伯语,要么在 phone 的开发人员选项中,您可以强制它在布局中显示 RTL。