{% 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 functions |
|
|---|---|
MotionEvent |
build()Returns a MotionEvent with the provided data or reasonable defaults. |
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 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 |
android.view.MotionEvent#getAction() |
fun setActionIndex(pointerIndex: Int): MotionEventBuilder
Sets the pointer index associated with the action.
| See also | |
|---|---|
MotionEvent |
android.view.MotionEvent#getActionIndex() |
fun setButtonState(buttonState: Int): MotionEventBuilder
Sets the button state.
| See also | |
|---|---|
MotionEvent |
android.view.MotionEvent#getButtonState() |
fun setDeviceId(deviceId: Int): MotionEventBuilder
Sets the device id.
| See also | |
|---|---|
MotionEvent |
android.view.MotionEvent#getDeviceId() |
fun setDownTime(downTime: Long): MotionEventBuilder
Sets the down time.
| See also | |
|---|---|
MotionEvent |
android.view.MotionEvent#getDownTime() |
fun setEdgeFlags(edgeFlags: Int): MotionEventBuilder
Sets the edge flags.
| See also | |
|---|---|
MotionEvent |
android.view.MotionEvent#getEdgeFlags() |
fun setEventTime(eventTime: Long): MotionEventBuilder
Sets the event time. Default is SystemClock.uptimeMillis().
| See also | |
|---|---|
MotionEvent |
android.view.MotionEvent#getEventTime() |
fun setFlags(flags: Int): MotionEventBuilder
Sets the flags.
| See also | |
|---|---|
MotionEvent |
android.view.MotionEvent#getFlags() |
fun setMetaState(metastate: Int): MotionEventBuilder
Sets the metaState.
| See also | |
|---|---|
MotionEvent |
android.view.MotionEvent#getMetaState() |
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 setSource(source: Int): MotionEventBuilder
Sets the source.
| See also | |
|---|---|
MotionEvent |
android.view.MotionEvent#getSource() |
fun setXPrecision(xPrecision: Float): MotionEventBuilder
Sets the x precision.
| See also | |
|---|---|
MotionEvent |
android.view.MotionEvent#getXPrecision() |
fun setYPrecision(yPrecision: Float): MotionEventBuilder
Sets the y precision.
| See also | |
|---|---|
MotionEvent |
android.view.MotionEvent#getYPrecision() |