【发布时间】:2019-11-06 09:31:24
【问题描述】:
如何创建始终包含触摸屏幕的手指数量的(可全局访问的)变量?
谢谢
int counter;
public boolean onTouch(View v, MotionEvent event) {
switch(event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
`enter code here`
break;
case MotionEvent.ACTION_POINTER_DOWN:
`enter code here`
break;
case MotionEvent.ACTION_MOVE:
`enter code here`
break;
case MotionEvent.ACTION_POINTER_UP:
`enter code here`
break;
case MotionEvent.ACTION_UP:
`enter code here
}
return true;
}
【问题讨论】:
标签: android android-studio touch touch-event