5

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?

Hetfieldan24
  • 198
  • 11
lidkxx
  • 2,731
  • 2
  • 25
  • 44
  • 3
    follow this link https://stackoverflow.com/questions/39069549/why-are-my-buttons-click-areas-too-small-inside-a-collapsingtoolbarlayout – Ankita Sep 21 '17 at 08:18
  • Thanks @Ankita! Following the answer from this link I determined that my toolbar in fact stayed at the top and was overshadowing my buttons making them unclickable! – lidkxx Sep 21 '17 at 09:32
  • Then upvote me :P – Ankita Sep 21 '17 at 09:35

1 Answers1

-1

Try to add this XML attribute

android:descendantFocusability="blocksDescendants"

to your CollapsingToolbarLayout

Saneesh
  • 1,796
  • 16
  • 23