I want to buttons of different colors, but I want to do so while using
the default button background resource in order to preserve the
onfocus and onclick states. This is because I want to use the default
highlight color of the OS for my app, which is NOT always orange (HTC
Sense makes it green).
I found that adding a color filter to the button's background drawable
works great (in this case, blue):
myButton.getBackground().setColorFilter(Color.parseColor(this.getString
(R.color.button_blue)), Mode.MULTIPLY);
BUT, when the button is focused or clicked, it turns a nasty
orange_blue because it mixes the color filter with the orange of the
background drawable.
I want to ONLY set this color filter for the unfocused/unclicked nine-
patch drawable within the default button's statelistdrawable.
I'm not sure how else to do this.
I see a similar solution here:
http://stackoverflow.com/questions/2065430/fixed-android-detecting-fo...
but I have some concerns with that solution, mainly what if the OS
changes the graphic of the default button? Since the normal unfocused/
unpressed graphic is now hardcoded into the app, it would break the
flow.
Maybe can someone comment on whether it would be good or bad practice
to hardcode the default graphic into the app? What are the chances of
the OS completely changing the graphic?
Any help please? Thanks very much!!