未捕获ACTION_POINTER_DOWN事件

时间:2017-09-27 07:21:41

标签: android

我写了下面的代码,我无法理解它有什么问题。它没有捕获MotionEvent.ACTION_POINTER_DOWN。

 public boolean onTouch(View vk,MotionEvent me)
 {
 if(me.getActionMasked()==MotionEvent.ACTION_DOWN)
 {
 start_pinch=1;
 tv.setBackgroundResource(R.drawable.shape);
 }
 if(me.getActionMasked()==MotionEvent.ACTION_POINTER_DOWN)
 {
 Toast.makeText(MainActivity.this,""+start_pinch, 
 Toast.LENGTH_SHORT).show();
 }
 return true;
 }

1 个答案:

答案 0 :(得分:0)

要求在方法public boolean onTouch(View vk,MotionEvent me){ if(me.getActionMasked()==MotionEvent.ACTION_DOWN){ start_pinch=1; tv.setBackgroundResource(R.drawable.shape); return true; } if(me.getActionMasked()==MotionEvent.ACTION_POINTER_DOWN){ Toast.makeText(MainActivity.this,""+start_pinch, Toast.LENGTH_SHORT).show(); return true; } return false; }

处添加退货

样品:

{{1}}