View.RequestPointerCapture Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| RequestPointerCapture() |
Requests pointer capture mode. |
| RequestPointerCapture(Int32) |
Requests pointer capture in the specified mode. |
RequestPointerCapture()
Requests pointer capture mode.
[Android.Runtime.Register("requestPointerCapture", "()V", "GetRequestPointerCaptureHandler", ApiSince=26)]
public virtual void RequestPointerCapture();
[<Android.Runtime.Register("requestPointerCapture", "()V", "GetRequestPointerCaptureHandler", ApiSince=26)>]
abstract member RequestPointerCapture : unit -> unit
override this.RequestPointerCapture : unit -> unit
- Attributes
Remarks
Requests pointer capture mode.
When the window has pointer capture, the mouse pointer icon will disappear and will not change its position. Enabling pointer capture will change the behavior of input devices in the following ways: <ul> <li>Events from a mouse will be delivered with the source InputDevice#SOURCE_MOUSE_RELATIVE, and relative position changes will be available through MotionEvent#getX and MotionEvent#getY.</li>
<li>Events from a touchpad or trackpad will be delivered with the source InputDevice#SOURCE_TOUCHPAD, where the absolute position of each of the pointers on the touchpad will be available through MotionEvent#getX(int) and MotionEvent#getY(int), and their relative movements are stored in MotionEvent#AXIS_RELATIVE_X and MotionEvent#AXIS_RELATIVE_Y.</li>
<li>Events from other types of devices, such as touchscreens, will not be affected.</li> </ul>
When pointer capture changes, connected mouse and trackpad devices may be reconfigured, and their properties (such as their sources or motion ranges) may change. Use an android.hardware.input.InputManager.InputDeviceListener to be notified when a device changes (which may happen after enabling or disabling pointer capture), and use InputDevice#getDevice(int) to get the updated InputDevice.
Events captured through pointer capture will be dispatched to OnCapturedPointerListener#onCapturedPointer(View, MotionEvent) if an OnCapturedPointerListener is set, and otherwise to #onCapturedPointerEvent(MotionEvent).
If the window already has pointer capture, this call does nothing.
The capture may be released through #releasePointerCapture(), or will be lost automatically when the window loses focus.
Java documentation for android.view.View.requestPointerCapture().
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
RequestPointerCapture(Int32)
Requests pointer capture in the specified mode.
[Android.Runtime.Register("requestPointerCapture", "(I)V", "GetRequestPointerCapture_IHandler", ApiSince=37)]
public virtual void RequestPointerCapture(int mode);
[<Android.Runtime.Register("requestPointerCapture", "(I)V", "GetRequestPointerCapture_IHandler", ApiSince=37)>]
abstract member RequestPointerCapture : int -> unit
override this.RequestPointerCapture : int -> unit
Parameters
- mode
- Int32
The mode in which to capture the pointer, which determines how events from touchpads are delivered. Value is one of the following: POINTER_CAPTURE_MODE_UNCAPTURED; POINTER_CAPTURE_MODE_ABSOLUTE; POINTER_CAPTURE_MODE_RELATIVE
- Attributes
Remarks
Requests pointer capture in the specified mode.
When the window has pointer capture, the mouse pointer icon will disappear and will not change its position. Enabling pointer capture will change the behavior of input devices in the following ways: Events from a mouse will be delivered with the source InputDevice.SOURCE_MOUSE_RELATIVE, and relative position changes will be available through MotionEvent.getX and MotionEvent.getY; Events from a touchpad (also known as a trackpad) will be delivered according to the chosen pointer capture mode. See POINTER_CAPTURE_MODE_RELATIVE and POINTER_CAPTURE_MODE_ABSOLUTE for details; Events from other types of devices, such as touchscreens, will not be affected.
Pointer ballistics curves and the user's pointer speed settings will not be applied in this mode.
When pointer capture changes, connected mouse and touchpad devices may be reconfigured, and their properties (such as their sources or motion ranges) may change. Use an InputManager.InputDeviceListener to be notified when a device changes (which may happen after enabling or disabling pointer capture), and use InputDevice.getDevice(int) to get the updated InputDevice.
Events captured through pointer capture will be dispatched to OnCapturedPointerListener.onCapturedPointer(View,MotionEvent) if an OnCapturedPointerListener is set, and otherwise to onCapturedPointerEvent(MotionEvent).
If the window already has pointer capture in the same mode, this call does nothing. If it already has pointer capture in a different mode, it will transition to the new mode.
The capture may be released through releasePointerCapture(), or will be lost automatically when the window loses focus.
Android reference for android.view.View.requestPointerCapture.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.