Search code examples
androidright-to-leftandroid-gridlayout

Place items from right to left in gridLayout


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?


Solution

  • 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"