当我点击图像视图时,他们无法执行任何操作,他们无法更改图像后面的可绘制图像。如何在该代码中使用选择器。
rel1.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View arg0, MotionEvent event) {
int action = event.getAction();
if (action != MotionEvent.ACTION_DOWN
&& action != MotionEvent.ACTION_MOVE
&& action != MotionEvent.ACTION_UP) return false;
Rect hitRect = new Rect();
ImageView button;
for(int i = 0; i < myButton1.size(); i++) {
button = myButton1.get(i);
button.getHitRect(hitRect);
if (hitRect.contains((int)event.getX(), (int)event.getY())) {
//myButton1.get(i).setImageDrawable(getResources().getDrawable(R.drawable.white_up));
SoundManager.playShoot(i);
}
}
return true;
}
});