Understanding Android Touches

Caren Chang

As Android developers, we use common methods like setOnClickListener() or setOnLongClickListener() all the time without a second thought. While those methods seem to work like magic, they are actually quite simple to understand once we understand some basic view and touch concepts. In this talk we’ll trace through the steps to see how Android decides which view should handle a touch. We’ll visually examine how a view hierarchy is laid out and examine the multiple methods that are involved when handling touches. Lastly, we’ll look into the different kinds of touches that are categorized in Android and when the system finally decides the action is a ‘touch’.

To wrap up the talk, we’ll look at an example of a custom translucent bottom bar laid over a recycler view. Using our newfound knowledge on touches, we’ll modify the navigation bar to handle different scenarios (such as scrolls, and clicking on a icon) so it can know when to handle a touch event, and when it should pass the event to the recycler view behind it.

Edit proposal