I have read How can I create a multilingual android application? and Do android support multiple languages? and I know about creating an android application with multiple languages. But my problem is about showing right-to-left and left-to-right texts for different languages.
For example in English a TextView
as label should be on the left side of EditText
and in Persian, TextView
should be on the right side of EditText
.
How can I support right to left languages and UIs in my user interface?
Should I design different layouts for right to left languages? How can I specify a folder in layouts for RTL? something like layout-rtl
? Or how can I determine the language is right to left?
Is there any easier way?
Official support was introduced in Android 4.2, see RTL Layout Support. You can query whether it is being used through enter link description here.
You can either try and use the same layout in all cases, or specify a specific layout in 'layout-ldrtl'.
As per your example, if you're using the RelativeLayout you need to use the android:layout_alignParentStart attribute, rather than the android:layout_alignParentLeft to shift your label from left to right automatically.
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