I have created menus with GridLayout. It currently looks like this:
It looks ugly because item which has biggest height value is different from other item's height. What I want is to adjust all item's height based on item which has the biggest height value, so all items is in same height. How I can achieve this?
Here is my layout code
<GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:columnCount="2">
<androidx.cardview.widget.CardView
android:id="@+id/btn_info1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:layout_columnWeight="1"
android:clickable="true"
android:focusable="true"
android:foreground="?android:attr/selectableItemBackground">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="5dp"
android:text="1"
android:textAlignment="center"
android:textSize="24sp"
tools:ignore="HardcodedText" />
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/btn_info2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:layout_columnWeight="1"
android:clickable="true"
android:focusable="true"
android:foreground="?android:attr/selectableItemBackground">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="5dp"
android:text="2"
android:textAlignment="center"
android:textSize="24sp"
tools:ignore="HardcodedText" />
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/btn_info3"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:layout_columnWeight="1"
android:clickable="true"
android:focusable="true"
android:foreground="?android:attr/selectableItemBackground">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="5dp"
android:text="3"
android:textAlignment="center"
android:textSize="24sp"
tools:ignore="HardcodedText" />
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/btn_info4"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:layout_columnWeight="1"
android:clickable="true"
android:focusable="true"
android:foreground="?android:attr/selectableItemBackground">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="5dp"
android:text="ITEM WITH MAX HEIGHT"
android:textAlignment="center"
android:textSize="24sp"
tools:ignore="HardcodedText" />
</androidx.cardview.widget.CardView>
</GridLayout>