问题
I have a GridLayout
in one of my layouts.
I want to place items from right to left, Which means I want to have cell(1,1) in top right of my layout.
I have tested these codes in GridView
so far:
1- android:gravity="right"
and android:layout_gravity="right"
but it doesn't work.
2- I also tested android:layoutDirection="rtl"
and it doesn't work too. how can I place items from right to left?
回答1:
Here is a workaround
add this line to your GridView
in XML:
android:rotationY="180"
then add the same line to your GridView
item in XML:
android:rotationY="180"
回答2:
You should use in the viewgroup
android:layoutDirection="locale"
and then in whatever item you have inside set the gravity like this:
android:gravity="start" # or end
I know this is an old question a just wanted to complete a more accurate answer for people finding this post
来源:https://stackoverflow.com/questions/25845714/place-items-from-right-to-left-in-gridlayout