I have a RelativeLayout with a TextView child, when set long click listener for text view, and set click listener for parent layout as below:
textview.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
Toast.makeText(getContext(), "longclick", Toast.LENGTH_SHORT).show();
return true;
}
});
layout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getContext(), "layout onclick", Toast.LENGTH_SHORT).show();
}
});
How do i handle layout's click listener when click on textview ? I also use GestureDetector to deal with, but ondown event must return true, this cause parent view can not handle onclick listener.
You need to also set
ClickListener()to yourtextviewcheck the below tested example it will work for u
Try this
LAYOUT