无法在CollapsingToolbarLayout中单击项目

lid*_*kxx 5 android android-layout android-collapsingtoolbarlayout

我实现了CollapsingToolbarLayout看起来像这样的:

折叠工具栏布局

当我滚动时它会折叠,但是有一个大问题:我无法单击其中的项目(后退按钮,编辑按钮,编辑文本字段等)。没有项目对单击/触摸事件做出反应。

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

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

  //close tags as appropriate here
Run Code Online (Sandbox Code Playgroud)

如何使这些项目可点击(嗯,不能android:clickable="true"确定地设置)?是否可以不使用Java/Kotlin代码编写侦听器?

San*_*esh -1

尝试添加此 XML 属性

android:descendantFocusability="blocksDescendants"
Run Code Online (Sandbox Code Playgroud)

到您的 CollapsingToolbarLayout