{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}
class MotionEventBuilder
A helper builder for creating MotionEvent's.
Default values for unspecified attributes are 0 unless otherwise noted.
Public constructors |
|
|---|---|
Public functions |
|
|---|---|
MotionEvent! |
build()Returns a MotionEvent with the provided data or reasonable defaults. |
java-static MotionEventBuilder! |
Start building a new MotionEvent. |
MotionEventBuilder! |
Sets the action. |
MotionEventBuilder! |
setActionIndex(pointerIndex: Int)Sets the pointer index associated with the action. |
MotionEventBuilder! |
setButtonState(buttonState: Int)Sets the button state. |
MotionEventBuilder! |
setDeviceId(deviceId: Int)Sets the device id. |
MotionEventBuilder! |
setDownTime(downTime: Long)Sets the down time. |
MotionEventBuilder! |
setEdgeFlags(edgeFlags: Int)Sets the edge flags. |
MotionEventBuilder! |
setEventTime(eventTime: Long)Sets the event time. |
MotionEventBuilder! |
Sets the flags. |
MotionEventBuilder! |
setMetaState(metastate: Int)Sets the metaState. |
MotionEventBuilder! |
setPointer(x: Float, y: Float)Simple mechanism to add a pointer to the MotionEvent. |
MotionEventBuilder! |
setPointer(An expanded variant of |
MotionEventBuilder! |
Sets the source. |
MotionEventBuilder! |
setXPrecision(xPrecision: Float)Sets the x precision. |
MotionEventBuilder! |
setYPrecision(yPrecision: Float)Sets the y precision. |
fun build(): MotionEvent!
Returns a MotionEvent with the provided data or reasonable defaults.
java-static fun newBuilder(): MotionEventBuilder!
Start building a new MotionEvent.
| Returns | |
|---|---|
MotionEventBuilder! |
a new MotionEventBuilder. |
fun setAction(action: Int): MotionEventBuilder!
Sets the action. Default is MotionEvent.ACTION_DOWN.
| See also | |
|---|---|
MotionEvent |
|
fun setActionIndex(pointerIndex: Int): MotionEventBuilder!
Sets the pointer index associated with the action.
| See also | |
|---|---|
MotionEvent |
|
fun setButtonState(buttonState: Int): MotionEventBuilder!
Sets the button state.
| See also | |
|---|---|
MotionEvent |
|
fun setDeviceId(deviceId: Int): MotionEventBuilder!
Sets the device id.
| See also | |
|---|---|
MotionEvent |
|
fun setDownTime(downTime: Long): MotionEventBuilder!
Sets the down time.
| See also | |
|---|---|
MotionEvent |
|
fun setEdgeFlags(edgeFlags: Int): MotionEventBuilder!
Sets the edge flags.
| See also | |
|---|---|
MotionEvent |
|
fun setEventTime(eventTime: Long): MotionEventBuilder!
Sets the event time. Default is SystemClock.uptimeMillis().
| See also | |
|---|---|
MotionEvent |
|
fun setMetaState(metastate: Int): MotionEventBuilder!
Sets the metaState.
| See also | |
|---|---|
MotionEvent |
|
fun setPointer(x: Float, y: Float): MotionEventBuilder!
Simple mechanism to add a pointer to the MotionEvent.
Can be called multiple times to add multiple pointers to the event.
fun setPointer(
pointerProperties: PointerProperties!,
pointerCoords: PointerCoords!
): MotionEventBuilder!
An expanded variant of setPointer that supports specifying all pointer properties and coords data.
fun setXPrecision(xPrecision: Float): MotionEventBuilder!
Sets the x precision.
| See also | |
|---|---|
MotionEvent |
|
fun setYPrecision(yPrecision: Float): MotionEventBuilder!
Sets the y precision.
| See also | |
|---|---|
MotionEvent |
|