android 和资源限定符中的 RTL 语言支持 [英] RTL Languages support in android and resource qualifiers
问题描述
我读到这句话Android 2.3 增加了对从右到左 (RTL) 语言的支持"现在我想为我的应用程序添加 RTL 支持.但我不知道要添加到我的布局中的限定符是什么.
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.
关于 res/values/strings.xml ,我可以这样命名 res/values-ar/strings.xml
About res/values/strings.xml , I can named like this res/values-ar/strings.xml
我想为 RLT 语言设置不同的布局.我不想只有不同的字符串,我也想要不同的布局.布局文件夹名称应该是什么样的?
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 ?
此时对于从左到右的语言,它被命名为res/lauyots/main.xml但我不知道如何为 RTL 语言命名
At this moment for the left to right languages it is named res/lauyots/main.xml but I do not know how to name it for RTL languages
这种限定符是否存在?
推荐答案
@Silwek 是对的.这是他的答案,我只是把它放在这里,因为我的答案已被标记为已回答.
@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)
旧答案
检查 本地化 和 多屏支持,它们让您了解资源文件夹和限定符.
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:
对于特定语言的资源:
res/values/strings.xml
res/values-fr/strings.xml (French)
res/values-ja/strings.xml (Japanese)
对于特定语言的布局:
res/layout-fr/main.xml
res/layout-ar/main.xml
这篇关于android 和资源限定符中的 RTL 语言支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!