TouchDelegate
public
class
TouchDelegate
extends Object
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, first create an instance that specifies 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)
to onTouchEvent(MotionEvent)
.
Summary
Constants | |
---|---|
int |
ABOVE
The touchable region of the View extends above its actual extent. |
int |
BELOW
The touchable region of the View extends below its actual extent. |
int |
TO_LEFT
The touchable region of the View extends to the left of its actual extent. |
int |
TO_RIGHT
The touchable region of the View extends to the right of its actual extent. |
Public constructors | |
---|---|
TouchDelegate(Rect bounds, View delegateView)
Constructor |
Public methods | |
---|---|
boolean
|
onTouchEvent(MotionEvent event)
Will forward touch events to the delegate view if the event is within the bounds specified in the constructor. |
Inherited methods | |
---|---|
Constants
ABOVE
public static final int ABOVE
The touchable region of the View extends above its actual extent.
Constant Value: 1 (0x00000001)
BELOW
public static final int BELOW
The touchable region of the View extends below its actual extent.
Constant Value: 2 (0x00000002)
TO_LEFT
public static final int TO_LEFT
The touchable region of the View extends to the left of its actual extent.
Constant Value: 4 (0x00000004)
TO_RIGHT
public static final int TO_RIGHT
The touchable region of the View extends to the right of its actual extent.
Constant Value: 8 (0x00000008)
Public constructors
TouchDelegate
public TouchDelegate (Rect bounds, View delegateView)
Constructor
Parameters | |
---|---|
bounds |
Rect : Bounds in local coordinates of the containing view that should be mapped to
the delegate view |
delegateView |
View : The view that should receive motion events
|
Public methods
onTouchEvent
public boolean onTouchEvent (MotionEvent event)
Will forward touch events to the delegate view if the event is within the bounds specified in the constructor.
Parameters | |
---|---|
event |
MotionEvent : The touch event to forward |
Returns | |
---|---|
boolean |
True if the event was forwarded to the delegate, false otherwise. |
Annotations
Interfaces
- ActionMode.Callback
- ActionProvider.VisibilityListener
- Choreographer.FrameCallback
- CollapsibleActionView
- ContextMenu
- ContextMenu.ContextMenuInfo
- GestureDetector.OnContextClickListener
- GestureDetector.OnDoubleTapListener
- GestureDetector.OnGestureListener
- InputQueue.Callback
- KeyEvent.Callback
- LayoutInflater.Factory
- LayoutInflater.Factory2
- LayoutInflater.Filter
- Menu
- MenuItem
- MenuItem.OnActionExpandListener
- MenuItem.OnMenuItemClickListener
- PixelCopy.OnPixelCopyFinishedListener
- ScaleGestureDetector.OnScaleGestureListener
- SubMenu
- SurfaceHolder
- SurfaceHolder.Callback
- SurfaceHolder.Callback2
- TextureView.SurfaceTextureListener
- View.OnApplyWindowInsetsListener
- View.OnAttachStateChangeListener
- View.OnCapturedPointerListener
- View.OnClickListener
- View.OnContextClickListener
- View.OnCreateContextMenuListener
- View.OnDragListener
- View.OnFocusChangeListener
- View.OnGenericMotionListener
- View.OnHoverListener
- View.OnKeyListener
- View.OnLayoutChangeListener
- View.OnLongClickListener
- View.OnScrollChangeListener
- View.OnSystemUiVisibilityChangeListener
- View.OnTouchListener
- View.OnUnhandledKeyEventListener
- ViewGroup.OnHierarchyChangeListener
- ViewManager
- ViewParent
- ViewStub.OnInflateListener
- ViewTreeObserver.OnDrawListener
- ViewTreeObserver.OnGlobalFocusChangeListener
- ViewTreeObserver.OnGlobalLayoutListener
- ViewTreeObserver.OnPreDrawListener
- ViewTreeObserver.OnScrollChangedListener
- ViewTreeObserver.OnTouchModeChangeListener
- ViewTreeObserver.OnWindowAttachListener
- ViewTreeObserver.OnWindowFocusChangeListener
- Window.Callback
- Window.OnFrameMetricsAvailableListener
- Window.OnRestrictedCaptionAreaChangedListener
- WindowManager
Classes
- AbsSavedState
- ActionMode
- ActionMode.Callback2
- ActionProvider
- Choreographer
- ContextThemeWrapper
- Display
- Display.HdrCapabilities
- Display.Mode
- DisplayCutout
- DragAndDropPermissions
- DragEvent
- FocusFinder
- FrameMetrics
- FrameStats
- GestureDetector
- GestureDetector.SimpleOnGestureListener
- Gravity
- HapticFeedbackConstants
- InputDevice
- InputDevice.MotionRange
- InputEvent
- InputQueue
- KeyboardShortcutGroup
- KeyboardShortcutInfo
- KeyCharacterMap
- KeyCharacterMap.KeyData
- KeyEvent
- KeyEvent.DispatcherState
- LayoutInflater
- MenuInflater
- MotionEvent
- MotionEvent.PointerCoords
- MotionEvent.PointerProperties
- OrientationEventListener
- OrientationListener
- PixelCopy
- PointerIcon
- ScaleGestureDetector
- ScaleGestureDetector.SimpleOnScaleGestureListener
- SearchEvent
- SoundEffectConstants
- Surface
- SurfaceView
- TextureView
- TouchDelegate
- VelocityTracker
- View
- View.AccessibilityDelegate
- View.BaseSavedState
- View.DragShadowBuilder
- View.MeasureSpec
- ViewAnimationUtils
- ViewConfiguration
- ViewDebug
- ViewGroup
- ViewGroup.LayoutParams
- ViewGroup.MarginLayoutParams
- ViewGroupOverlay
- ViewOutlineProvider
- ViewOverlay
- ViewPropertyAnimator
- ViewStructure
- ViewStructure.HtmlInfo
- ViewStructure.HtmlInfo.Builder
- ViewStub
- ViewTreeObserver
- Window
- WindowAnimationFrameStats
- WindowContentFrameStats
- WindowId
- WindowId.FocusObserver
- WindowInsets
- WindowManager.LayoutParams
Enums
Exceptions