OnTouchListener doesn't work with relative layout
In myRelativeLayout.xml add:
android:clickable="true"
android:focusable="true"
android:focusableInTouchMode="true"
This worked for me:
yourRelativeLayout.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View arg0, MotionEvent arg1) {
//gesture detector to detect swipe.
gestureDetector.onTouchEvent(arg1);
return true;//always return true to consume event
}
});
tv.setClickable(true);
is causing your layout, not to fire touch event. Try removing this.