Beruflich Dokumente
Kultur Dokumente
com/racialequity)
Kotlin (/reference/kotlin/android/view/TouchDelegate) | Java
java.lang.Object (/reference/java/lang/Object)
↳ android.view.TouchDelegate
Helper class to handle situations where you want a view to have a larger touch area than its
actual view bounds. The view whose touch area is changed is called the delegate view. This
class should be used by an ancestor of the delegate. To use a TouchDelegate, rst create an
instance that speci es the bounds that should be mapped to the delegate and the delegate
view itself.
The ancestor should then forward all of its touch events received in its
View.onTouchEvent(MotionEvent)
(/reference/android/view/View#onTouchEvent(android.view.MotionEvent)) to
onTouchEvent(android.view.MotionEvent)
(/reference/android/view/TouchDelegate#onTouchEvent(android.view.MotionEvent)).
Summary
Constants
int ABOVE (/reference/android/view/TouchDelegate#ABOVE)
The touchable region of the View extends above its actual extent.
int BELOW (/reference/android/view/TouchDelegate#BELOW)
The touchable region of the View extends below its actual extent.
int TO_LEFT (/reference/android/view/TouchDelegate#TO_LEFT)
The touchable region of the View extends to the left of its actual extent.
int TO_RIGHT (/reference/android/view/TouchDelegate#TO_RIGHT)
The touchable region of the View extends to the right of its actual extent.
Public constructors
TouchDelegate
(/reference/android/view/TouchDelegate#TouchDelegate(android.graphics.Rect,%20android.view.View))
(Rect (/reference/android/graphics/Rect) bounds, View (/reference/android/view/View)
delegateView)
Constructor
Public methods
AccessibilityNodeInfo. getTouchDelegateInfo
TouchDelegateInfo (/reference/android/view/TouchDelegate#getTouchDelegateInfo())()
(/reference/android/view/accessi
bility/AccessibilityNodeInfo.Touch Return a TouchDelegateInfo
DelegateInfo) (/reference/android/view/accessibility/AccessibilityNodeInfo.TouchDele
gateInfo)
mapping from regions (in view coordinates) to delegated views for
accessibility usage.
boolean onTouchEvent
(/reference/android/view/TouchDelegate#onTouchEvent(android.view.M
otionEvent))
(MotionEvent (/reference/android/view/MotionEvent) event)
Forward touch events to the delegate view if the event is within the
bounds speci ed in the constructor.
boolean onTouchExplorationHoverEvent
(/reference/android/view/TouchDelegate#onTouchExplorationHoverEven
t(android.view.MotionEvent))
(MotionEvent (/reference/android/view/MotionEvent) event)
Forward hover events to the delegate view if the event is within the
bounds speci ed in the constructor and touch exploration is enabled.
Inherited methods
boolean equals
(/reference/java/lang/Object#equals(java.lang.Object))
(Object (/reference/java/lang/Object) obj)
final Class (/reference/java/lang/Class)<?>getClass (/reference/java/lang/Object#getClass())()
int hashCode (/reference/java/lang/Object#hashCode())()
String (/reference/java/lang/String) toString (/reference/java/lang/Object#toString())()
Constants
The touchable region of the View extends above its actual extent.
The touchable region of the View extends below its actual extent.
The touchable region of the View extends to the left of its actual extent.
The touchable region of the View extends to the right of its actual extent.
Public constructors
Constructor
Parameters
bounds Rect: Bounds in local coordinates of the containing view that should be
mapped to the delegate view
Public methods
public AccessibilityNodeInfo.TouchDelegateInfo (/reference/android/view/accessibility/Accessib
Return a TouchDelegateInfo
(/reference/android/view/accessibility/AccessibilityNodeInfo.TouchDelegateInfo) mapping from regions
(in view coordinates) to delegated views for accessibility usage.
Returns
Forward touch events to the delegate view if the event is within the bounds speci ed in the
constructor.
Parameters
event MotionEvent: The touch event to forward This value cannot be null.
Returns
boolean True if the event was consumed by the delegate, false otherwise.
onTouchExplorationHoverEvent
Added in API level 29 (/guide/topics/manifest/uses-sdk-element#ApiLevels)
Forward hover events to the delegate view if the event is within the bounds speci ed in the
constructor and touch exploration is enabled.
This method is provided for accessibility purposes so touch exploration, which is commonly
used by screen readers, can properly place accessibility focus on views that use touch
delegates. Therefore, touch exploration must be enabled for hover events to be dispatched
through the delegate.
Parameters
event MotionEvent: The hover event to forward This value cannot be null.
Returns
boolean True if the event was consumed by the delegate, false otherwise.
See also:
AccessibilityManager.isTouchExplorationEnabled()
(/reference/android/view/accessibility/AccessibilityManager#isTouchExplorationEnabled())
Content and code samples on this page are subject to the licenses described in the Content License (/license). Java
is a registered trademark of Oracle and/or its a liates.