I have a "cell" in my list with picture, text and a checkbox. Here's my xml
fragment_people_list_item.xml
:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android">
// ... more elements
<CheckBox />
</RelativeLayout>
I'd like to distinguish if user taps on a checkbox or on the rest of the view. A relevant part of my RecyclerView.OnItemTouchListener
:
@Override
public boolean onInterceptTouchEvent(RecyclerView recyclerView, MotionEvent e) {
View childView = recyclerView.findChildViewUnder(e.getX(), e.getY());
}
It says that findChildViewUnder
finds the topmost view under the given point which is ALWAYS my RelativeLayout
!
How can I know on which view exactly user tapped (clicked)?