1

When objects do not fit in three lines, they go beyond, and I need that if there are too many of them they passed to the next row. Is it possible way to fix it? Thanks.
columnCount is 2
columnCount is 3 and higher

<GridLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:columnCount="2">

    <FrameLayout
         android:layout_width="160dp"
         android:layout_gravity="center_horizontal"
         android:layout_columnWeight="1"/>
    <FrameLayout
         android:layout_width="160dp"
         android:layout_gravity="center_horizontal"
         android:layout_columnWeight="1"/>
    <FrameLayout
         android:layout_width="160dp"
         android:layout_gravity="center_horizontal"
         android:layout_columnWeight="1"/>

</GridLayout>

1 Answers1

0

Your columnCount is 2 but you have 3 children. Change the columnCount to 3 and see.

<GridLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:columnCount="3">

    <FrameLayout
         android:layout_width="160dp"
         android:layout_gravity="center_horizontal"
         android:layout_columnWeight="1"/>
    <FrameLayout
         android:layout_width="160dp"
         android:layout_gravity="center_horizontal"
         android:layout_columnWeight="1"/>
    <FrameLayout
         android:layout_width="160dp"
         android:layout_gravity="center_horizontal"
         android:layout_columnWeight="1"/>

</GridLayout>