View.OnTouchEvent(MotionEvent) 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.
Implement this method to handle touch screen motion events.
[Android.Runtime.Register("onTouchEvent", "(Landroid/view/MotionEvent;)Z", "GetOnTouchEvent_Landroid_view_MotionEvent_Handler")]
public virtual bool OnTouchEvent (Android.Views.MotionEvent? e);
[<Android.Runtime.Register("onTouchEvent", "(Landroid/view/MotionEvent;)Z", "GetOnTouchEvent_Landroid_view_MotionEvent_Handler")>]
abstract member OnTouchEvent : Android.Views.MotionEvent -> bool
override this.OnTouchEvent : Android.Views.MotionEvent -> bool
Parameters
The motion event.
Returns
True if the event was handled, false otherwise.
- Attributes
Remarks
Implement this method to handle touch screen motion events.
If this method is used to detect click actions, it is recommended that the actions be performed by implementing and calling #performClick()
. This will ensure consistent system behavior, including: <ul> <li>obeying click sound preferences <li>dispatching OnClickListener calls <li>handling AccessibilityNodeInfo#ACTION_CLICK ACTION_CLICK
when accessibility features are enabled </ul>
Java documentation for android.view.View.onTouchEvent(android.view.MotionEvent)
.
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.