1
걸리고 싶습니다. 만 두 손가락으로 터치하십시오 (한 손가락 터치는 사용하지 말아야합니다). 불행히도 "두 손가락 터치"이벤트를 얻으려면 "한 손가락 터치"를 사용해야합니다. 나는 분명히 희망한다. 여기두 손가락 터치 만 사용하십시오.
내 코드 :
@Override
public boolean onTouch(View v, MotionEvent m)
{
boolean consumed = false;
int pointerCount = m.getPointerCount();
int action = m.getActionMasked();
if(pointerCount == 2)
{
switch (action)
{
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_POINTER_DOWN:
consumed = true;
break;
case MotionEvent.ACTION_UP:
// Work
break;
case MotionEvent.ACTION_MOVE:
// Some stuff
break;
default:
break;
}
}
else if (pointerCount == 1 && action == MotionEvent.ACTION_DOWN)
{
// This is needed to get the 2 fingers touch events...
consumed = true;
}
return consumed;
}
해결 했습니까? –
Unfortunatly, no ... –
어제 검색 후 시간이 지나도 필요할 경우를 대비하여 내 사용자 정의보기에서 모든 이벤트를 캡처하고보기와 관련된 이벤트를 전달했습니다. –