View.OnResolvePointerIcon(MotionEvent, Int32) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
解析動作事件中應該用於指定指標的指標圖示。
[Android.Runtime.Register("onResolvePointerIcon", "(Landroid/view/MotionEvent;I)Landroid/view/PointerIcon;", "GetOnResolvePointerIcon_Landroid_view_MotionEvent_IHandler", ApiSince=24)]
public virtual Android.Views.PointerIcon? OnResolvePointerIcon(Android.Views.MotionEvent? e, int pointerIndex);
[<Android.Runtime.Register("onResolvePointerIcon", "(Landroid/view/MotionEvent;I)Landroid/view/PointerIcon;", "GetOnResolvePointerIcon_Landroid_view_MotionEvent_IHandler", ApiSince=24)>]
abstract member OnResolvePointerIcon : Android.Views.MotionEvent * int -> Android.Views.PointerIcon
override this.OnResolvePointerIcon : Android.Views.MotionEvent * int -> Android.Views.PointerIcon
參數
用於 e. 的 Android.Views.MotionEvent 值。
- pointerIndex
- Int32
中指標的索引 event ,用以取得 PointerIcon。 這會介於 0 到 MotionEvent#getPointerCount()之間。
傳回
指定指標時會用指標圖示,或 null 如果未指定指標圖示,則使用預設圖示。
- 屬性
備註
解析動作事件中應該用於指定指標的指標圖示。
預設實作會將指標圖示解析到某一組,用於 #setPointerIcon(PointerIcon) 滑鼠裝置。 子職業可以覆寫此限制,以自訂該指標的圖示。
例如,觸控筆指標的指標圖示可以用以下方式解析: <pre> @Override public PointerIcon onResolvePointerIcon(MotionEvent event, int pointerIndex) { final int toolType = event.getToolType(pointerIndex); if (!event.isFromSource(InputDevice.SOURCE_MOUSE) && event.isFromSource(InputDevice.SOURCE_STYLUS) && (toolType == MotionEvent.TOOL_TYPE_STYLUS || toolType == MotionEvent.TOOL_TYPE_ERASER)) { // Show this pointer icon only if this pointer is a stylus. return PointerIcon.getSystemIcon(mContext, PointerIcon.TYPE_WAIT); } // Use the default logic for determining the pointer icon for other non-stylus pointers, // like for the mouse cursor. return super.onResolvePointerIcon(event, pointerIndex); } </pre>
Java 文件 android.view.View.onResolvePointerIcon(android.view.MotionEvent, int)。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。