I\'ve set up an ImageButton to be transparent, so the icon matches the backgrond panel like the Android ActionBar. This looks fine as I want it to.
However, when the
If you want to do it programmatically, here is one solution:
Create a custom ImageButton class and Override drawableStateChange():
public class CustomImageButton extends ImageButton {
@Override
protected void drawableStateChanged() {
Log.d("Button", "isPressed: " + isPressed() );
if( isPressed() ){
setBackgroundResource( android.R.color.holo_blue_dark );
} else {
setBackgroundResource( android.R.color.transparent );
}
super.drawableStateChanged();
}
public CustomImageButton( Context context ) {
super( context );
}
public CustomImageButton( Context context, AttributeSet attrs ) {
super( context, attrs );
}
public CustomImageButton( Context context, AttributeSet attrs, int defStyle ) {
super( context, attrs, defStyle );
// TODO Auto-generated constructor stub
}
}