代码之家  ›  专栏  ›  技术社区  ›  thanhbinh84

如何检测Pixelbook笔按钮?

  •  4
  • thanhbinh84  · 技术社区  · 6 年前

    the doc here 在绘图时捕捉Pixelbook笔上按下的按钮,但不会抛出工具类型橡皮擦事件。当我试图打印日志时,我看不出按住和松开按钮之间有什么区别:

    onTouchEvent:MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=2010.4766, y[0]=778.10156, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1395185, downTime=1395185, deviceId=1, source=0x1002 }
    2018-09-29 16:15:35.527 2926-2926/com.  onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2009.2734, y[0]=777.6406, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=4, eventTime=1395195, downTime=1395185, deviceId=1, source=0x1002 }
    2018-09-29 16:15:35.552 2926-2926/com.  onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2008.0703, y[0]=776.71484, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=9, eventTime=1395221, downTime=1395185, deviceId=1, source=0x1002 }
    2018-09-29 16:15:35.569 2926-2926/com.  onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2007.8867, y[0]=776.25, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=3, eventTime=1395238, downTime=1395185, deviceId=1, source=0x1002 }
    2018-09-29 16:15:35.594 2926-2926/com.  onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2008.0703, y[0]=775.6953, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=7, eventTime=1395263, downTime=1395185, deviceId=1, source=0x1002 }
    2018-09-29 16:15:35.611 2926-2926/com.  onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2008.2578, y[0]=774.58594, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=6, eventTime=1395280, downTime=1395185, deviceId=1, source=0x1002 }
    2018-09-29 16:15:35.624 2926-2926/com.  onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2008.3477, y[0]=773.28906, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=5, eventTime=1395295, downTime=1395185, deviceId=1, source=0x1002 }
    2018-09-29 16:15:35.624 2926-2926/com.  onTouchEvent:MotionEvent { action=ACTION_UP, actionButton=0, id[0]=0, x[0]=2008.3477, y[0]=773.28906, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1395297, downTime=1395185, deviceId=1, source=0x1002 }
    2018-09-29 16:15:42.632 2926-2926/com.  onTouchEvent:MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=2018.3477, y[0]=1013.64453, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1402304, downTime=1402304, deviceId=1, source=0x1002 }
    2018-09-29 16:15:42.643 2926-2926/com.  onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2018.5312, y[0]=1013.64453, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=2, eventTime=1402312, downTime=1402304, deviceId=1, source=0x1002 }
    2018-09-29 16:15:42.660 2926-2926/com.  onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2018.1641, y[0]=1013.5508, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=6, eventTime=1402329, downTime=1402304, deviceId=1, source=0x1002 }
    2018-09-29 16:15:42.668 2926-2926/com.  onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2018.1641, y[0]=1013.46094, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1402337, downTime=1402304, deviceId=1, source=0x1002 }
    2018-09-29 16:15:42.669 2926-2926/com.  onTouchEvent:MotionEvent { action=ACTION_UP, actionButton=0, id[0]=0, x[0]=2018.1641, y[0]=1013.46094, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1402342, downTime=1402304, deviceId=1, source=0x1002 }
    

    1 回复  |  直到 6 年前
        1
  •  1
  •   thanhbinh84    6 年前

    Google团队确认事件被系统占用,应用程序无法用当前API捕捉到。

    推荐文章