February 2014
Intermediate to advanced
772 pages
18h 53m
English
3-14. Forwarding Touch Events
Problem
You have views or other touch targets in your application that are too small for the average finger to reliably activate.
Solution
(API Level 1)
Use TouchDelegate to designate an arbitrary rectangle to forward touch events to your small views. TouchDelegate is designed to attach to a parent ViewGroup for the purpose of forwarding touch events it detects within a specific space to one of its children. TouchDelegate modifies each event to look to the target view as if it had happened within its own bounds.
How It Works
Listings 3-38 and 3-39 illustrate the use of TouchDelegate within a custom parent ViewGroup.
Listing 3-38. Custom Parent Implementing TouchDelegate
public class TouchDelegateLayout extends ...Read now
Unlock full access