how to create android linearlayout with RTL horizontal orientation

2022-09-02 00:37:54

I want to create a linear layout with horizontal orientation

but I want it to position its children aligned to its right and not to its left as usual

how can I do this?

I know how to do this using relativeLayout, but I want to practice linearLayout


答案 1

You can use android:layoutDirection attribute which is introduced in 4.2(jelly bean).

The following links will help.

http://developer.android.com/reference/android/view/View.html#attr_android:layoutDirection

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


答案 2

if you are using Android studio you can do this:

1- right click on the project main folder

2- refactor

3- add support for RTL