I have a ListView that displays some data. The rows can be clicked as well. I also have a custom Fragment at the bottom of the screen that "hovers" over the ListView all the time. I want this Fragment to also pick up click events so that I can do stuff when it's clicked.
The issue is that I can't figure out how to do that, and the ListView ends up getting the click instead, even when the Fragment covers that particular row.
Basically, I want to make sure that when there is a Fragment (or even another View) on top of the ListView, that Fragment registers the click when I click on it, and not the ListView. How do I do this?
CodePudding user response:
If another View or Fragment is over it, you can prevent clicks from reaching through by setting the android:clickable
attribute to true
on the root of the layout that is presented on top of something else clickable.
The same goes for the layout inflated in the Fragment displayed on top of something else, just set android:clickable
to true on the root of the inflated layout.
android:clicable="true"