我的TextView不支持MotionEvent.Action_UP.我在event.getAction上只得到0.
但是相同的代码对于ImageButton来说是完美的.@H_301_3@
Textview不支持MotionEvent.Action_UP吗?@H_301_3@
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.这样,其他事件将传递给您的听众.