Understand how touch events work and master gestures
Compose provides APIs for detecting touch events and gestures. By combining these APIs appropriately, you can easily implement gestures. However, to implement your own gestures, you need to understand how touch events work. Furthermore, in situations where gestures conflict between overlapping composables, it becomes more difficult to make the gestures work as intended. In this session, we will explain how touch events work and share the know-how to make gestures work as intended. I will explain how to implement your own gestures while avoiding gesture conflicts between composables, and also share common pitfalls. During the session, I will introduce as an example a library called Zoomable, which I developed and released. Zoomable is a Compose library that allows you to zoom images using gestures. I made a self-implementation of gestures and devised a way to prevent gestures from conflicting with the parent composable. The main use case is to place an image on top of a pager. It is designed so that both pinch gestures on the image and scroll gestures on the pager work as intended. Through this session, you will gain a deeper understanding of touch events and be able to control gestures as intended. Contents: - How to implement gestures - Simple APIs such as onClick - How to use the detectGestures API - How to create your own gesture detection process - How events work - How events are transmitted - How to share events and prevent them from being passed to other elements - How to distinguish between tapping and scrolling - How to handle event cancellation - How to implement fling (with inertia) behaviors (Translated by the DroidKaigi Committee)
-
usuiat Android Engineer
Summary
- Dates 2024.09.13 / 16:20 ~ 17:00 (40min)
- Place Giraffe
- Language Japanese
Intended audience
People who want to deepen their understanding of Compose's touch events and gestures People who are having trouble with gestures not working as intended
Sessions in the same time slot
Debugging: All You Need to Know
Jumpei Matsuda
#Development Tools and Services
Put some 3D sparkles in your 2D app
Daniele Bonaldo
#Development Tools and Services
Check UI variations of Android apps by various means
Nozomi Takuma
#UI・UX・Design