Cant click items inside CollapsingToolbarLayout

Viewed 1559

I've implemented the CollapsingToolbarLayout that looks like this:

collapsing toolbar layout

It collapses when I scroll, however there's a big problem: I am unable to click items inside it (back button, edit button, edit text field etc). None of the items react to click/touch events.

Now, the "logic" sits in XML with the following structure:

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

  //close tags as appropriate here

How do I make the items clickable (well, not by setting android:clickable="true" for sure)? Is it possible without writing listeners in Java/Kotlin code?

1 Answers

Try to add this XML attribute

android:descendantFocusability="blocksDescendants"

to your CollapsingToolbarLayout

Related