在 AndroidManifest xml 文件中如何使用 android: support-sRtl = “ true”

每当我在 android 工作室创建新项目时,我都会在我的应用程序 AndroidManifest File 中获得 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。

96775 次浏览

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.

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

From Android API-Guides:

(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.

if you are building an app in Arabic, Urdu, Hebrew, etc... or any language that is written from right to left you should set android:supportsRtl to true, that's how you tell the layout to be from right to left, and The default value of this attribute is false.

If you develop application which supports RTL layouts(layout mirroring) you should tace care of two things

  1. Declare supporting RTL mirroring in AndroidManifest.xml
<application
android:supportsRtl="true">
</application>
  1. Use start/end instead/in addition to left/right
android:margineLeft
android:margineStart