material-components-android icon indicating copy to clipboard operation
material-components-android copied to clipboard

[Standard bottom sheet] Views hidden behind the bottom sheet respond to touch events.

Open glanium opened this issue 7 months ago • 0 comments

Description:

Views hidden behind the bottom sheet respond to touch events.

Source code:

In your Catalog app, Change cat_bottomsheet_fragment.xml as following

<androidx.coordinatorlayout.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/cat_bottomsheet_coordinator_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

<!-- Change RelativeLayout  to LinearLayout -->
  <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical">
    <Button
        android:id="@+id/bottomsheet_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:layout_centerHorizontal="true"
        android:text="@string/cat_bottomsheet_button_text"/>
      <com.google.android.material.materialswitch.MaterialSwitch
          android:id="@+id/cat_fullscreen_switch"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_below="@id/bottomsheet_button"
          android:layout_centerHorizontal="true"
          android:padding="16dp"
          android:textSize="14sp"
          android:textAllCaps="true"
          android:text="@string/cat_bottomsheet_switch_text"/>
    <com.google.android.material.materialswitch.MaterialSwitch
        android:id="@+id/cat_bottomsheet_expansion_switch"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/cat_fullscreen_switch"
        android:layout_centerHorizontal="true"
        android:padding="16dp"
        android:text="@string/cat_bottomsheet_expansion_switch_text"
        android:textAllCaps="true"
        android:textSize="14sp"/>

<!-- Add CheckBoxes here -->
    <CheckBox
      android:layout_width="match_parent"
      android:layout_height="wrap_content"/>

    <CheckBox
      android:layout_width="match_parent"
      android:layout_height="wrap_content"/>

    <CheckBox
      android:layout_width="match_parent"
      android:layout_height="wrap_content"/>

    <CheckBox
      android:layout_width="match_parent"
      android:layout_height="wrap_content"/>

    <CheckBox
      android:layout_width="match_parent"
      android:layout_height="wrap_content"/>

    <CheckBox
      android:layout_width="match_parent"
      android:layout_height="wrap_content"/>

    <CheckBox
      android:layout_width="match_parent"
      android:layout_height="wrap_content"/>

    <CheckBox
      android:layout_width="match_parent"
      android:layout_height="wrap_content"/>

    <CheckBox
      android:layout_width="match_parent"
      android:layout_height="wrap_content"/>

    <CheckBox
      android:layout_width="match_parent"
      android:layout_height="wrap_content"/>

    <CheckBox
      android:layout_width="match_parent"
      android:layout_height="wrap_content"/>

    <CheckBox
      android:layout_width="match_parent"
      android:layout_height="wrap_content"/>

    <CheckBox
      android:layout_width="match_parent"
      android:layout_height="wrap_content"/>

    <CheckBox
      android:layout_width="match_parent"
      android:layout_height="wrap_content"/>

  </LinearLayout>

  <!-- Standard bottom sheet will be added here. -->

</androidx.coordinatorlayout.widget.CoordinatorLayout>

Then run catalog app, Expand standard bottom sheet. Tap bottom sheet anywhere When tapped, the checkboxes hidden behind the bottom sheet respond and checked or unchecked.

Expected behavior: The checkboxes hidden behind the bottom sheet never respond.

Android API version: API 31

Material Library version: 1.13.0-alpha04

thx

glanium avatar Jul 11 '24 11:07 glanium