setting transparency to buttons in android
Using XML
If you want to set color and along with that if you want to set transparent then you have to use that color code .
android:color="#66FF0000" // Partially transparent red
android:alpha="0.25" // 25% transparent
Using java
And if you want to set dynamically (java code)then try this,
myButton.getBackground().setAlpha(64); // 25% transparent
- i.e .INT ranges from 0 (fully transparent) to 255 (fully opaque)
You can define your own "transparent" color in styles.xml and play with the alfa of the color, for example:
<color name="Transparent">#00000000</color>
<color name="Transparent80">#80000000</color>
EDIT: second one is 50% transparency