我的TextView不支持MotionEvent.Action_UP.我在event.getAction上只得到0.
Textview不支持MotionEvent.Action_UP吗?
textView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(final View v,final MotionEvent event) { Log.v("tag","textView"+event.getAction()); if (event.getAction() == MotionEvent.ACTION_DOWN) { Log.v("tag","textViewmousedown"); } else if(event.getAction() == MotionEvent.ACTION_UP) { //This gets never called Log.v("tag","textViewmouseup"); if (standardButtonClickListener != null) { standardButtonClickListener.onStandardButtonClick(v); } } return false; } });
解决方法
您必须在onTouch方法中返回true而不是false.这样,其他事件将传递给您的听众.