以下代码分别用于检测
- 是否为手写笔事件
- 是否为橡皮擦事件
- 是否为手写笔主按钮
- 是否为手写笔辅按钮
override fun dispatchTouchEvent(event: MotionEvent): Boolean {val isStylus = event.getToolType(event.actionIndex) == MotionEvent.TOOL_TYPE_STYLUSval isEraser = event.getToolType(event.actionIndex) == MotionEvent.TOOL_TYPE_ERASERval isStylusPrimaryButton = event.buttonState == MotionEvent.BUTTON_STYLUS_PRIMARYval isStylusSecondaryButton = event.buttonState == MotionEvent.BUTTON_STYLUS_SECONDARYreturn super.dispatchTouchEvent(event)
}