I\'ve made an app, I\'ve tested it and it was fine on my phone. But... when I gave the .apk to someone else whose phone language is RTL the whole layout broke and it messed up e
Android 4.2 added full native support for RTL layouts. To take advantage of RTL layout mirroring, simply make the following changes to your app:
Declare in your app manifest that your app supports RTL mirroring.
Specifically, add android:supportsRtl="true"
to the
element in your manifest file.
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
.
For more precise control over your app UI in both LTR and RTL mode, Android 4.2 includes the following new APIs to help manage View components:
-- Source & Credits --
In your manifest file and inside the application tag add these two lines.
<manifest>
<application
.
.
.
android:supportsRtl="false"
tools:replace="android:supportsRtl" //(replace libraries' Rtl support with ours)
>
</application>
</manifest>
Note: (about second line) Some libraries have support Rtl in their manifest file so if you want to use those libraries you must replace their manifest line of code with yours.
Just add the following to the manifest
android:supportsRtl="false"
tools:replace="android:supportsRtl"