trying to set the layout elements to be RTL ordered
in 4.2 and above the line: layoutDirection="rtl"
and in the manifest: android:supportsRtl="true"
is working just fine.
but for below 4.2 its not.
solution anyone ?
On devices running Android 4.4 (API level 19) or higher, you can enable Force RTL layout direction in the on-device developer options. This setting allows you to see text that uses LTR scripts, such as English text, in RTL mode.
In your android phone, tap on “Settings” icon. Now tap on developer options and search for “Force RTL layout direction”. Tap on it to enable RTL feature.
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”.
RTL. Horizontal layout direction is from Right to Left.
Just use ViewCompat using android.support.v4.view to do it.
ViewCompat.setLayoutDirection(findViewById(R.id.my_view), ViewCompat.LAYOUT_DIRECTION_RTL);
You won't be able to. It was added to in API Level 17 which is 4.2 so the older versions do not support it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With