Due to the lack of answers to the question, the optimal way to lay out the Grid-style bottom sheet with header, I decided to specify it. Having tried to impose the layout below (taken from official guidelines ), I found out that GridLayout is still better.

enter image description here

If we specify padding on the left and right 24dp GridLayout container, then the row delimiter will begin and end within these indents. It is necessary that he was from the left to the right edge of the screen. How can this be achieved?

Sample markup:

 <?xml version="1.0" encoding="utf-8"?> <GirdLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingStart="24dp" android:paddingEnd="24dp" > <!-- Содержимое --> <View android:layout_height="1dp" android:layout_width="wrap_content" android:layout_weight="1" android:layout_color="#000" android:alpha="0.14" /> </GirdLayout> 

enter image description here

    1 answer 1

    Can. You need to set the android:clipToPadding="false" on the container, and set the margin to a negative margin :

     <?xml version="1.0" encoding="utf-8"?> <GirdLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingStart="24dp" android:paddingEnd="24dp" android:clipToPadding="false" > <!-- Содержимое --> <View android:layout_width="match_parent" android:layout_height="1dp" android:layout_marginStart="-24dp" android:layout_marginEnd="-24dp" android:alpha="0.14" android:background="#000" /> </GirdLayout> 
    • Everything is fine rolling! Thank you for your reply! - Bokov Gleb