Android 阿拉伯语文本对齐方式 [英] Android Arabic text alignment
问题描述
我使用 如何在 Android 中支持阿拉伯语文本? 显示阿拉伯文字.在 Android 2.1 - 2.3 文本位于左侧,所以我使用 android:gravity="right",但在 Android 3.0+ 阿拉伯文本在右侧自动对齐,如果我使用 android:gravity="right" 将是在左侧对齐.如何让文字在不同的Android版本中对齐?
I use class from How to support Arabic text in Android? to show Arabic text. In Android 2.1 - 2.3 text located in the left side, so I use android:gravity="right", but in Android 3.0+ Arabic text has automatically alignment in right side and if I use android:gravity="right" in will be alignment in the left side. How can I make the text to be aligned with the same in different Android versions?
推荐答案
您可以为不同的 API 版本创建不同版本的布局.
You can create different versions of the layouts for different API versions.
您可以在此处阅读:http://developer.android.com/guide/topics/resources/providing-resources.html 你可以说普通文件夹 (/res/layout/
) 与旧设备的布局,然后另一个用于支持它的:/res/layout-11/
As you can read here: http://developer.android.com/guide/topics/resources/providing-resources.html you can have say the normal folder (/res/layout/
) with the layout for old devices and then another one for the ones that support it: /res/layout-11/
layout-v11
中的布局将仅适用于 android 3.0 及更高版本的设备.
The layout inside layout-v11
will only be applied on devices with android 3.0 and over.
希望有帮助.(更新:API 级别更改为 11)
Hope it helps. (UPD: API level changed to 11)
更新
在 Android 4.2 上,这是一个原生功能 :)
On Android 4.2 This is a native feature :)
http://android-developers.blogspot.com.es/2013/03/native-rtl-support-in-android-42.html
这篇关于Android 阿拉伯语文本对齐方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!