O'Reilly logo

Android UI Fundamentals: Develop and Design by Jason Ostrander

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

8. Handling Gestures

The basic Android UI toolkit provides the most common interaction gestures you will need in your application: taps, long presses, and swipes. But sometimes the built-in gestures aren’t sufficient for your application or are not available on the view you’re using. For those cases, Android provides the ability to create custom gestures. This chapter introduces the basics of detecting and responding to gestures. Along the way, you’ll learn that all views have an onTouchEvent method you can use to intercept touch events; that the MotionEvent class is the low-level interface to the touchscreen inputs; that you should use GestureDetector and its subclasses to enable the most common gestures; and that you can enable pinch-to-zoom ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required