无法单击CollapsingToolbarLayout中的项目

我已经实现了如下所示的CollapsingToolbarLayout

折叠的工具栏布局

当我滚动的时候会崩溃,但是有一个很大的问题:我无法点击它里面的项目(后退按钮,编辑按钮,编辑文本框等)。 没有任何项目对点击/触摸事件作出反应。

现在,“逻辑”位于XML中,结构如下:

  <CoordinatorLayout> <AppBarLayout> <CollapsingToolbarLayout> <RelativeLayout/> here's where the panel layout sits <Toolbar/> <NestedScrollView/> //close tags as appropriate here 

如何使项目可点击(当然,不是通过设置android:clickable="true"肯定)? 在Java/Kotlin代码中编写监听器是否可能?

尝试添加这个XML属性

 android:descendantFocusability="blocksDescendants" 

到您的CollapsingToolbarLayout