我需要实现 onItemLongPressListener 和 onTouchListener。它们不能一起工作,所以我必须从其他的 ontouch 侦听器返回 false,以便项目长按侦听器也被触发。
当我触摸 imageButton 时,我需要更改图像按钮,但由于我的触摸监听器返回 false,因此图像保持按下状态。
当我不再触摸按钮时,如何让它改变按钮图像?
imageView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
imageView.setImageResource(mThumbIdsPressed[position]);
} else {
imageView.setImageResource(mThumbIds[position]);
}
recordAudio.startPlaying(position);
return false;
}
});