当DrawerLayout里的菜单是通过include引进菜单布局时,点击菜单的空白部分会穿透从而触发主内容布局中的事件。

 

解决方法:(超简单)

在include的布局里添加clickable="true"即可

例如include如下

<include
  android:id="@+id/main_menu"
  layout="@layout/layout_main_menu"
  android:layout_width="300dp"
  android:layout_height="match_parent"
  android:layout_gravity="start" />

那么在layout_main_menu文件的根布局加上clickable="true"

 

相关文章:

  • 2022-12-23
  • 2021-06-20
  • 2021-11-18
  • 2022-12-23
  • 2021-12-11
  • 2021-10-26
  • 2022-01-25
  • 2022-12-23
猜你喜欢
  • 2023-01-06
  • 2021-07-14
  • 2022-12-23
  • 2021-12-29
  • 2021-08-31
  • 2022-12-23
相关资源
相似解决方案