Is it possible using an ImageButton to have touch down and highlighted states, without the need for 2 more image resources on Android (6 more, considering h/m/ldpi)? I'm basically looking for behavior similar to iOS where the OS can put an semi-alpha overlay on the touch down state of a button.
I've tried using setColorFilter(0xFF000000, Mode.MULTIPLY)
in the onTouch listener, and the result was pretty close to what I was after - but I'm not sure the best way of the state handling to achieve this:
i.e.
- touchDown event -> Change color overlay.
- touchUp event -> remove color overlay, and perform button action.
Is there a better way... Or can someone help fill in the gaps?
I don't want to use separate images for a couple of reasons - it's an iPhone port for which I don't have the appropriate assets yet, and would require more designer time considering I've got the low/medium/high creatives to consider.
Thanks!