I have a toolbar with a transparent/translucent background that overlays the content. So, behind the toolbar, views can appear that are clickable. The problem is that they can not be clicked through the toolbar because the toolbar is catching the click event.
I tried setting android:clickable="false"
, android:focusable="false"
and android:focusableInTouchMode="false"
for the toolbar, but it has no effect. How can I send a click through the toolbar to the underlying view?
Toolbar consumes all clicks. You need to subclass Toolbar, like @Matthias Robbens already mentioned.
If you still want to be able to set a click listener on the toolbar, use this:
Take a look at the implementation of
Toolbar
. It eats touch events, regardless of theclickable
attribute.The solution is to extend from
Toolbar
and overrideonTouchEvent
.Your design needs to be adjusted. You cannot provide clickable views behind a transparent/translucent toolbar. You need to provide a top padding equal to the height of the toolbar and/or implement the quick return pattern for the toolbar.