Chapter 13. Handling Input and Scrolling

In the previous chapter, “Developing Custom Views,” you worked through how to create a custom view that properly handles measurement, layout, drawing, and saving/restoring state. Now it’s time to round out that knowledge with a deep look at handling input and scrolling.

Touch Input

Touch input is the primary means of interacting with views in Android. In most cases, you can use the standard listeners, such as OnClickListener and OnLongClickListener, to handle the interactions. In some cases, you need to handle custom, more complex touches. If a view already meets your needs but you just need to handle custom touches, then consider using the OnTouchListener to avoid having to subclass the view.

Touch ...

Get Android User Interface Design: Implementing Material Design for Developers, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.