RTL Languages support in android and resource qualifiers
I read this sentence " Android 2.3 added support for right-to-left (RTL) languages" and now I want to add RTL support to my app. But I do not know what is qualifiers to add to my layouts.
About res/values/strings.xml , I can named like this res/values-ar/strings.xml
I want to have different layout for RLT languages. I do not want to have just different strings , I also want different layout. What the layout folder name should look like ?
At this moment for the left to right languages it is named r开发者_如何学Pythones/lauyots/main.xml but I do not know how to name it for RTL languages
Is this kind qualifier is present at all ?
You can find -ldrtl and -ldltr qualifiers in Providing resources
res/layout-ldltr/ (Left to Right, default value)
res/layout-ldrtl/ (Right to Left)
@Silwek is right. This is his answer, I am merely putting it here because my answer has been marked as answered.
res/layout-ldltr/ (Left to Right, default value)
res/layout-ldrtl/ (Right to Left)
Old Answer
Check Localization and Multiple Screen Support, they give you idea about resource folders and qualifiers.
You can use locale specific resources and layout like this:
For language specific resources:
res/values/strings.xml
res/values-fr/strings.xml (French)
res/values-ja/strings.xml (Japanese)
For language specific layouts:
res/layout-fr/main.xml
res/layout-ar/main.xml
Using rtl with resources is not a correct approach .. you missed that Devices with RTL locale such Arabic,Hebrew, Persian ... usually enforce all apps ( even with english language only ) to use rtl as language direction and text direction... and here where its dangerous to use rtl in resources because you will cause using your RTL layout for all languages for RTL Locale device. Better to track languages.
精彩评论