androidandroid-layoutright-to-left

How to override RTL support on a layout in Android


I set android:supportsRtl="true" in the <application> tag in AndroidManifest.xml, but I need to force one of the views to be left-to-right (LTR) nonetheless, even when the language of the interface is Hebrew or Arabic. How can I force a specific view to be LTR in an RTL application?

Specifically, I want to force some linear layout to go left-to-right instead of the default right-to-left even when the language is right-to-left.


Solution

  • Generally gravity="left" is enough to force text to be left-to-right. But it didn't help with the direction of a linear layout. The solution was to add android:layoutDirection="ltr".