Android - Consume onTouch of parent view having multiple Clickable children
android, gesture, ontouchlistener, touch
Solution
Now, I want to keep the two items clickable and detect a swipe action on the parent View, i.e. the LinearLayout.
You could create your own row `View` which extends `LinearLayout` and will wrap those two child views. For this override the `onInterceptTouchEvent` and the `onTouch` methods to detect the swipe. If you need to know which row are you currently swiping you could have your custom view remember its position in the list and update the position in the `getView` method of the adapter.
Another option, I think, would be to have an overlay view on top of the normal row view which will handle the swipe.
Problem
I have a `ListView` in an `Activity`. The `ListView` rows are `LinearLayout`s each and contain two children `View`s, both are `clickable`. The structure is like this - ``` ______________________________ | | | |______|_______________________| ``` Now, I want to keep the two items `clickable` and detect a swipe action on the parent `View`, i.e. `the LinearLayout`. Could you please suggest me what would be the best approach for this?