How can I detect if the user did only tap and NOT swipe the ViewPager
?
When I use OnTouchListener
, I can never "just" touch or swipe. A Move
event is always preceded by an Up
/ Down
event.
This code always shows me the Toast, no matter if I just tap or swipe:
public class CardPicker : Fragment, View.IOnTouchListener
{
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
var view = inflater.Inflate(Resource.Layout.Cardpicker, container, false);
_cardPicker = view.FindViewById<ViewPager>
_cardPicker.SetOnTouchListener(this);
return view;
}
public bool OnTouch(View v, MotionEvent e)
{
if (e.Action == MotionEventActions.Down)
{
Toast.MakeText(Context,"Starting an Activity!", ToastLength.Short).Show();
return true;
}
return false;
}
}