public final class MotionEventCompat extends Object
MotionEvent
introduced
after API level 4 in a backwards compatible fashion.Modifier and Type | Method and Description |
---|---|
static int |
findPointerIndex(MotionEvent event,
int pointerId)
Deprecated.
Call
MotionEvent.findPointerIndex(int) directly. This method will be
removed in a future release. |
static int |
getActionIndex(MotionEvent event)
Call
MotionEvent.getAction() , returning only the pointer index
portion |
static int |
getActionMasked(MotionEvent event)
Call
MotionEvent.getAction() , returning only the ACTION_MASK
portion. |
static float |
getAxisValue(MotionEvent event,
int axis)
Get axis value for the first pointer index (may be an
arbitrary pointer identifier).
|
static float |
getAxisValue(MotionEvent event,
int axis,
int pointerIndex)
Returns the value of the requested axis for the given pointer index
(use
getPointerId(MotionEvent, int) to find the pointer identifier for this index). |
static int |
getButtonState(MotionEvent event) |
static int |
getPointerCount(MotionEvent event)
Deprecated.
Call
MotionEvent.getPointerCount() directly. This method will be
removed in a future release. |
static int |
getPointerId(MotionEvent event,
int pointerIndex)
Deprecated.
Call
MotionEvent.getPointerId(int) directly. This method will be
removed in a future release. |
static int |
getSource(MotionEvent event)
Deprecated.
Call
MotionEvent.getSource() directly. This method will be
removed in a future release. |
static float |
getX(MotionEvent event,
int pointerIndex)
Deprecated.
Call
MotionEvent.getX() directly. This method will be
removed in a future release. |
static float |
getY(MotionEvent event,
int pointerIndex)
Deprecated.
Call
MotionEvent.getY() directly. This method will be
removed in a future release. |
static boolean |
isFromSource(MotionEvent event,
int source)
Determines whether the event is from the given source.
|
public static final int ACTION_MASK
MotionEvent.ACTION_MASK
.public static final int ACTION_POINTER_DOWN
MotionEvent.ACTION_POINTER_DOWN
.public static final int ACTION_POINTER_UP
MotionEvent.ACTION_POINTER_UP
.public static final int ACTION_HOVER_MOVE
MotionEvent.ACTION_HOVER_MOVE
.public static final int ACTION_SCROLL
MotionEvent.ACTION_SCROLL
.public static final int ACTION_POINTER_INDEX_MASK
MotionEvent.ACTION_POINTER_INDEX_MASK
.public static final int ACTION_POINTER_INDEX_SHIFT
MotionEvent.ACTION_POINTER_INDEX_SHIFT
.public static final int ACTION_HOVER_ENTER
MotionEvent.ACTION_HOVER_ENTER
.public static final int ACTION_HOVER_EXIT
MotionEvent.ACTION_HOVER_EXIT
.public static final int AXIS_X
MotionEvent.AXIS_X
.public static final int AXIS_Y
MotionEvent.AXIS_Y
.public static final int AXIS_PRESSURE
MotionEvent.AXIS_PRESSURE
.public static final int AXIS_SIZE
MotionEvent.AXIS_SIZE
.public static final int AXIS_TOUCH_MAJOR
MotionEvent.AXIS_TOUCH_MAJOR
.public static final int AXIS_TOUCH_MINOR
MotionEvent.AXIS_TOUCH_MINOR
.public static final int AXIS_TOOL_MAJOR
MotionEvent.AXIS_TOOL_MAJOR
.public static final int AXIS_TOOL_MINOR
MotionEvent.AXIS_TOOL_MINOR
.public static final int AXIS_ORIENTATION
MotionEvent.AXIS_ORIENTATION
.public static final int AXIS_VSCROLL
MotionEvent.AXIS_VSCROLL
.public static final int AXIS_HSCROLL
MotionEvent.AXIS_HSCROLL
.public static final int AXIS_Z
MotionEvent.AXIS_Z
.public static final int AXIS_RX
MotionEvent.AXIS_RX
.public static final int AXIS_RY
MotionEvent.AXIS_RY
.public static final int AXIS_RZ
MotionEvent.AXIS_RZ
.public static final int AXIS_HAT_X
MotionEvent.AXIS_HAT_X
.public static final int AXIS_HAT_Y
MotionEvent.AXIS_HAT_Y
.public static final int AXIS_LTRIGGER
MotionEvent.AXIS_LTRIGGER
.public static final int AXIS_RTRIGGER
MotionEvent.AXIS_RTRIGGER
.public static final int AXIS_THROTTLE
MotionEvent.AXIS_THROTTLE
.public static final int AXIS_RUDDER
MotionEvent.AXIS_RUDDER
.public static final int AXIS_WHEEL
MotionEvent.AXIS_WHEEL
.public static final int AXIS_GAS
MotionEvent.AXIS_GAS
.public static final int AXIS_BRAKE
MotionEvent.AXIS_BRAKE
.public static final int AXIS_DISTANCE
MotionEvent.AXIS_DISTANCE
.public static final int AXIS_TILT
MotionEvent.AXIS_TILT
.public static final int AXIS_RELATIVE_X
MotionEvent.AXIS_RELATIVE_X
.public static final int AXIS_RELATIVE_Y
MotionEvent.AXIS_RELATIVE_Y
.public static final int AXIS_GENERIC_1
MotionEvent.AXIS_GENERIC_1
.public static final int AXIS_GENERIC_2
MotionEvent.AXIS_GENERIC_2
.public static final int AXIS_GENERIC_3
MotionEvent.AXIS_GENERIC_3
.public static final int AXIS_GENERIC_4
MotionEvent.AXIS_GENERIC_4
.public static final int AXIS_GENERIC_5
MotionEvent.AXIS_GENERIC_5
.public static final int AXIS_GENERIC_6
MotionEvent.AXIS_GENERIC_6
.public static final int AXIS_GENERIC_7
MotionEvent.AXIS_GENERIC_7
.public static final int AXIS_GENERIC_8
MotionEvent.AXIS_GENERIC_8
.public static final int AXIS_GENERIC_9
MotionEvent.AXIS_GENERIC_9
.public static final int AXIS_GENERIC_10
MotionEvent.AXIS_GENERIC_10
.public static final int AXIS_GENERIC_11
MotionEvent.AXIS_GENERIC_11
.public static final int AXIS_GENERIC_12
MotionEvent.AXIS_GENERIC_12
.public static final int AXIS_GENERIC_13
MotionEvent.AXIS_GENERIC_13
.public static final int AXIS_GENERIC_14
MotionEvent.AXIS_GENERIC_14
.public static final int AXIS_GENERIC_15
MotionEvent.AXIS_GENERIC_15
.public static final int AXIS_GENERIC_16
MotionEvent.AXIS_GENERIC_16
.public static final int BUTTON_PRIMARY
MotionEvent.BUTTON_PRIMARY
.public static int getActionMasked(MotionEvent event)
MotionEvent.getAction()
, returning only the ACTION_MASK
portion.public static int getActionIndex(MotionEvent event)
MotionEvent.getAction()
, returning only the pointer index
portion@Deprecated public static int findPointerIndex(MotionEvent event, int pointerId)
MotionEvent.findPointerIndex(int)
directly. This method will be
removed in a future release.@Deprecated public static int getPointerId(MotionEvent event, int pointerIndex)
MotionEvent.getPointerId(int)
directly. This method will be
removed in a future release.@Deprecated public static float getX(MotionEvent event, int pointerIndex)
MotionEvent.getX()
directly. This method will be
removed in a future release.MotionEvent.getX(int)
.@Deprecated public static float getY(MotionEvent event, int pointerIndex)
MotionEvent.getY()
directly. This method will be
removed in a future release.MotionEvent.getY(int)
.@Deprecated public static int getPointerCount(MotionEvent event)
MotionEvent.getPointerCount()
directly. This method will be
removed in a future release.@Deprecated public static int getSource(MotionEvent event)
MotionEvent.getSource()
directly. This method will be
removed in a future release.InputDeviceCompat.SOURCE_UNKNOWN
if unknown.public static boolean isFromSource(MotionEvent event, int source)
source
- The input source to check against.public static float getAxisValue(MotionEvent event, int axis)
public static float getAxisValue(MotionEvent event, int axis, int pointerIndex)
getPointerId(MotionEvent, int)
to find the pointer identifier for this index).axis
- The axis identifier for the axis value to retrieve.pointerIndex
- Raw index of pointer to retrieve. Value may be from 0
(the first pointer that is down) to getPointerCount(MotionEvent)
-1.AXIS_X
,
AXIS_Y
public static int getButtonState(MotionEvent event)
event
-