Start / end & left / right for RTL languages ​​in Android 4.2

I am trying to mock my application that will include RTL support. Target sdk version will be 15+ . I used start / end instead as left / right in all my layout files, however I noticed that the layout does not work as expected with RTL at api 17 (Android 4.2). Api levels 18 and above seem to handle double definitions (start and left), but this is very interesting, so I was wondering why the layout is placed at level 17. According to the text below, I would expect the same behavior at level 17 as 18+ ...

Built-in RTL support in Android 4.2:

If you are targeting your application on Android 4.2 (application targetSdkVersion or minSdkVersion is 17 or higher) then you should use "start" and "end" instead of "left" and "right". For example android: paddingLeft should become android: paddingStart.

If you want your application to work with versions earlier than Android 4.2 (application targetSdkVersion or minSdkVersion is 16 or less), then you must add "start" and end "in addition to" left "and" right ". For example, youd use android : paddingLeft and android: paddingStart.

+3


source to share


1 answer


Make a separate layout for 17+ like layout-v17 and put the default layout in the layout. In layout-v17, you only need to replace left-> start and right-> end with padding, margin, drwableleft, etc. Do not use the left and right 17 and plus symbols.



There is no other way.

0


source







All Articles