2

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?

Cœur
  • 34,719
  • 24
  • 185
  • 251
anber
  • 3,186
  • 5
  • 36
  • 62

1 Answers1

7

You can create different versions of the layouts for different API versions.

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/

The layout inside layout-v11 will only be applied on devices with android 3.0 and over.

Hope it helps. (UPD: API level changed to 11)

UPDATE

On Android 4.2 This is a native feature :)

http://android-developers.blogspot.com.es/2013/03/native-rtl-support-in-android-42.html

pablisco
  • 13,572
  • 4
  • 47
  • 69
  • [Ustav](http://stackoverflow.com/users/1294952/ustav) [points out](http://stackoverflow.com/suggested-edits/228384) that Android 3.0 is [API level 11](http://developer.android.com/guide/appendix/api-levels.html) not 10. – Rup Mar 27 '12 at 08:54