I am currently trying to set a click listener to a LinearLayout
view in the .xml
layout file using data binding.
I have managed to get it to wo
So everything was set up correctly and the generated bindings file shows the click listener being set up correctly, but for some very odd reason half the bindings were working and the newer ones weren't. By newer ones meaning the LinearLayout
and all the attempts around it.
What solved the problem was a simple cache invalidation and respective restart and voila, the click listener is working perfectly on the LinearLayout
. Just remember to set it clickable
and focusable
and any child views set as not clickable so they don't consume the event before the parent.
3 entire days around this one, took less than 10 minutes discussing with others here in the comments to remember trying to invalidate the cache of Android Studio, unbelievable of me...