Change Opacity in pressed state of image

button.setOnTouchListener(this);
@Override
public boolean onTouch(View v, MotionEvent event) {
  if (v == button) {
    if (event.getAction() == MotionEvent.ACTION_DOWN) {
      v.setAlpha(0.5f);
    } else {
      v.setAlpha(1f);
    }
  }
  return false;
}

You may use a flag to store state and call this to change opacity:

button.getBackground().setAlpha(60);

Create a custom ImageView class i.e. AlphaImageView that extends from ImageView and override the setPressed() method like so:

@Override
public void setPressed(boolean pressed) {
    super.setPressed(pressed);
    setAlpha(pressed ? 0.5f : 1.0f);
}