0

I want to implement a swipe from bottom gesture like windows 8 tablet in android.But I can't catch any touch begin from android navigation bar.

Here is my code in MainActivity.java:

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
    Log.d("touch",ev.toString());
    return super.dispatchTouchEvent(ev);
}

Swipe from left or right works fine.But nothing happends when I swipe from navigation bar or from bottom edge in non-navigation bar devices

I tested this on an Android 4.4.4 Tablet and Genymotion.

2
  • I swipe from bottom begin from android navigation bar Can you explain this? I could not understand how will you start swipe from bottom and navigation drawer Commented Apr 28, 2015 at 11:12
  • @Kushal I means virtual button bar,maybe I get a wrong name?Not navigation drawer at all. Commented Apr 28, 2015 at 11:15

1 Answer 1

2

First things first: Android: Difference between onInterceptTouchEvent and dispatchTouchEvent?. As stated by the best answer, dispatchTouchEvent is actually defined on Activity, View and ViewGroup. Think of it as a controller which decides how to route the touch events. With that in mind, we know that every touch event that starts from the navigation bar (i.e. when you touch your finger on the navigation bar, hold it and swipe up) is not going to be intercepted by the method dispatchTouchEvent.

If that was not the answer you are looking for, then i imagine that you're looking for a way to implement a menu that shows up when you swipe from the bottom-up . Look, this library should help you if this is what you want.

Edit: i found one more example that covers the entire swipe gestures subject that may help you. Follow this link.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks a lot!So sorry that I don't have enough reputation to vote up.
No problem, mate. Welcome to S.O.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.