I have a ListView in an Activity. The ListView rows are LinearLayouts each and contain two children Views, 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?
You could create your own row
Viewwhich extendsLinearLayoutand will wrap those two child views. For this override theonInterceptTouchEventand theonTouchmethods 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 thegetViewmethod 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.