I am trying to make layout like this
I am trying to use GridLayout to achieve this but the issue I am getting is some buttons are small in size and some are bigger in size. For the small size buttons it should move the next button closer to the last button but its not doing that. Its doing this
Any Idea of how to achieve this with Grid Layout or any other layout. This is the code for grid layout I am using
<GridLayout
android:layout_width="match_parent"
android:layout_marginTop="@dimen/_16ssp"
android:columnCount="3"
android:layout_marginHorizontal="@dimen/_16ssp"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/_16ssp"
android:background="@drawable/grey_20dp_10op"
android:paddingHorizontal="@dimen/_32ssp"
android:paddingVertical="@dimen/_8ssp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/regular"
android:text="ALL"
android:textColor="@color/black"
android:textSize="@dimen/_12ssp"></TextView>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/_16ssp"
android:background="@drawable/grey_20dp_10op"
android:paddingHorizontal="@dimen/_32ssp"
android:paddingVertical="@dimen/_8ssp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/regular"
android:text="Default"
android:textColor="@color/black"
android:textSize="@dimen/_12ssp"></TextView>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/_16ssp"
android:background="@drawable/grey_20dp_10op"
android:paddingHorizontal="@dimen/_32ssp"
android:paddingVertical="@dimen/_8ssp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/regular"
android:text="Default"
android:textColor="@color/black"
android:textSize="@dimen/_12ssp"></TextView>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/_16ssp"
android:layout_marginTop="@dimen/_16ssp"
android:background="@drawable/grey_20dp_10op"
android:paddingHorizontal="@dimen/_32ssp"
android:paddingVertical="@dimen/_8ssp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/regular"
android:text="Default"
android:textColor="@color/black"
android:textSize="@dimen/_12ssp"></TextView>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/_16ssp"
android:layout_marginTop="@dimen/_16ssp"
android:background="@drawable/grey_20dp_10op"
android:paddingHorizontal="@dimen/_32ssp"
android:paddingVertical="@dimen/_8ssp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/regular"
android:text="Default"
android:textColor="@color/black"
android:textSize="@dimen/_12ssp"></TextView>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/_16ssp"
android:layout_marginTop="@dimen/_16ssp"
android:background="@drawable/grey_20dp_10op"
android:paddingHorizontal="@dimen/_32ssp"
android:paddingVertical="@dimen/_8ssp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/regular"
android:text="Default"
android:textColor="@color/black"
android:textSize="@dimen/_12ssp"></TextView>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/_16ssp"
android:layout_marginTop="@dimen/_16ssp"
android:background="@drawable/grey_20dp_10op"
android:paddingHorizontal="@dimen/_32ssp"
android:paddingVertical="@dimen/_8ssp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/regular"
android:text="Default"
android:textColor="@color/black"
android:textSize="@dimen/_12ssp"></TextView>
</LinearLayout>
</GridLayout>