Search code examples
androidandroid-scrollviewbottom-sheet

Bottom sheet above the scrollView


I want this kind of bottom sheet which should be above the ScrollView.

enter image description here

The images in the scroll view should be behind the bottom sheet. the bottom sheet should always be there on the screen till the proceed button on it is clicked. Any help will be appreciated. Thanks !!


Solution

  • If the bottom sheet/panel is always there, theres no need to overlap those panels check this simplified xml layout example:

    <?xml version="1.0" encoding="utf-8"?>
    <!-- This is your root layout element -->
    <LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:android_width="match_parent"
      android:android_height="0dp"
      android:layout_weight="4">
    
      <ScrollView
        android:android_width="match_parent"
        android:android_height="0dp">
        <!-- Put your inner grid layout here -->
      </ScrollView>
    
    
      <!-- this is your bottom panel layout -->
      <!-- you can control the size of your bottom -->
      <!--  pane by playing with the layout weights  -->
      <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1">
    
        <Button
          android:text="Proceed"
          android:background="@drawable/yourSelectorXml"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"/>
      </LinearLayout>
    
     </LinearLayout>