faizal
faizal

Reputation: 3565

How to consume click event in view hierarchy

Is there a way to consume click events on a view so that it does not propagate to any other view in the view hierarchy?

For example, i have a view hierarchy that looks something like this :

List View -> LinearLayout(List view item) -> TableRow -> Space

I would like to consume the click event on the Space widget so that it does not propagate to the list view item.

Upvotes: 4

Views: 557

Answers (1)

Andrew Luo
Andrew Luo

Reputation: 927

return true from the onTouchEvent handler. Also, needs to set the Space widget's visibility to VISIBLE by

space.setVisibility(View.VISIBLE)

Not sure if this is a bug in the widget's code or by design not to respond to touch events.

Upvotes: 5

Related Questions