AndroidManifest xml 文件中 android:supportsRtl="true" 有什么用

What is use of android:supportsRtl="true" in AndroidManifest xml file

每当我在 android studio 中创建新项目时,我的应用程序 AndroidManifest 文件中都会出现 android:supportsRtl="true"

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

在应用程序中有什么用,或者我在我的应用程序中添加或不添加AndroidManifest 时的优点和缺点是什么。

Declares whether your application is willing to support right-to-left (RTL) layouts. If set to true and targetSdkVersion is set to 17 or higher, various RTL APIs will be activated and used by the system so your app can display RTL layouts. If set to false or if targetSdkVersion is set to 16 or lower, the RTL APIs will be ignored or will have no effect and your app will behave the same regardless of the layout direction associated to the user's Locale choice (your layouts will always be left-to-right).

The default value of this attribute is false.

This attribute was added in API level 17.

(来源:http://developer.android.com/guide/topics/manifest/application-element.html

来自 Android API-指南:

(developer.android.com/guide/topics/manifest/application-element.html)

Declares whether your application is willing to support right-to-left (RTL) layouts.

If set to true and targetSdkVersion is set to 17 or higher, various RTL APIs will be activated and used by the system so your app can display RTL layouts. If set to false or if targetSdkVersion is set to 16 or lower, the RTL APIs will be ignored or will have no effect and your app will behave the same regardless of the layout direction associated to the user's Locale choice (your layouts will always be left-to-right).

The default value of this attribute is false.

This attribute was added in API level 17.

如果您正在使用阿拉伯语、乌尔都语、希伯来语等...或任何从右到左书写的语言构建应用程序,您应该将 android:supportsRtl 设置为 true,这就是您的方式告诉布局从右到左,并且这个属性的默认值为false。

如果您开发支持RTL layouts(布局镜像)的应用程序,您应该注意两件事

  1. 在AndroidManifest.xml
  2. 中声明支持RTL镜像
<application
    android:supportsRtl="true">
</application>
  1. 使用 start/end instead/in 除了 left/right
android:margineLeft
android:margineStart