Skip to content

Commit 2a0dda8

Browse files
imhappihunterstich
authored andcommitted
[NavigationRail] Consume all touch events to avoid views under from receiving touch events.
PiperOrigin-RevId: 705270356
1 parent 782d260 commit 2a0dda8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/java/com/google/android/material/navigationrail/NavigationRailView.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@
2626
import static java.lang.Math.min;
2727

2828
import android.animation.TimeInterpolator;
29+
import android.annotation.SuppressLint;
2930
import android.content.Context;
3031
import androidx.appcompat.widget.TintTypedArray;
3132
import android.util.AttributeSet;
3233
import android.view.Gravity;
3334
import android.view.LayoutInflater;
35+
import android.view.MotionEvent;
3436
import android.view.View;
3537
import android.view.ViewGroup;
3638
import android.view.animation.PathInterpolator;
@@ -713,4 +715,12 @@ private void addContentContainer() {
713715
public boolean shouldAddMenuView() {
714716
return true;
715717
}
718+
719+
@SuppressLint("ClickableViewAccessibility")
720+
@Override
721+
public boolean onTouchEvent(@NonNull MotionEvent event) {
722+
super.onTouchEvent(event);
723+
// Consume all events to avoid views under the BottomNavigationView from receiving touch events.
724+
return true;
725+
}
716726
}

0 commit comments

Comments
 (0)