How to set the transparency of the image button programmatically in android? I am creating dynamic image buttons on the fly.
You should be able to change a button with the following:
btnMybutton.getBackground().setAlpha(45);
ImageButton.setBackgroundColor(Color.TRANSPARENT) Should solve the problem.
From http://developer.android.com/reference/android/view/View.html#setBackgroundColor%28int%29
Set the background to a given Drawable, or remove the background. If the background has padding, this View's padding is set to the background's padding. However, when a background is removed, this View's padding isn't touched. If setting the padding is desired, please use setPadding(int, int, int, int).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With