MotionEvent.ACTION_MOVE 이벤트가 발생할 때 포인터 ID를 얻으려고합니다.Android MotionEvent.getActionIndex() 및 MultiTouch
나는 event.getActionIndex()를 호출하여이 작업을 수행하지만 두 번째, 세 번째, 네 번째 및 다섯 번째 손가락에 항상 0을 반환합니다.
내가 갤럭시 S I9000 여기에
를 진저 브레드 2.3.3을 사용하고이 디버그 내가 이벤트를 덤프하기 위해이 코드를 사용하고
05-02 19:20:08.628: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=1
05-02 19:20:08.781: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=1
05-02 19:20:08.820: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=1
05-02 19:20:08.914: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=1
05-02 19:20:09.070: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=2
05-02 19:20:09.187: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=2
05-02 19:20:09.324: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=2
05-02 19:20:09.460: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=2
05-02 19:20:09.523: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=2
05-02 19:20:09.542: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=2
05-02 19:20:09.679: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=3
05-02 19:20:09.703: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=3
05-02 19:20:09.847: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=3
05-02 19:20:10.117: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=3
05-02 19:20:10.261: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=4
05-02 19:20:10.281: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=4
05-02 19:20:10.304: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=4
05-02 19:20:10.371: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=4
05-02 19:20:10.410: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=4
05-02 19:20:10.433: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=4
05-02 19:20:10.519: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=4
05-02 19:20:10.558: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=4
05-02 19:20:10.613: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=3
05-02 19:20:10.640: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=2
05-02 19:20:10.656: DEBUG/D(4534): getActionIndex()=0 getPointerCount()=1
코드 http://www.zdnet.com/blog/burnette/how-to-use-multi-touch-in-android-2-part-3-understanding- ([여기] 내지 touch event/1775? tag = mantle_skin; content) –
Jim, 나에게 제공 한 코드를 사용했는데, ACTION_MOVE 이벤트를 일으키는 포인터 ID를 제공하지 않는다는 것을 제외하고는 꽤 잘 작동한다. -02 20 : 15 : 38.863 : DEBUG/MTView (5033) : 이벤트 ACTION_MOVE [# 0 (PID 0) = 61,52; # 1 (PID 1) = 265,360]) 및 (05-02 20 : 15 : 38.878 : DEBUG/MTView (5033) : 이벤트 ACTION_MOVE [# 0 (pid 0) = 61,52; # 1 (pid 1) = 256,368]), 두 번째 손가락을 움직이면 두 이벤트가 연속됩니다. 짐 많이 빌려 줘서 고마워. – kamelbox
오신 것을 환영합니다. 그리고 어떤 손가락이 사건을 일으켰는지 알려주지 않습니다. 각 손가락의 현재 위치를 알려줍니다. 물론 현재 위치를 이전 위치와 비교하면 어떤 손가락이 그것을 초래했는지 추측 할 수 있습니다. –