I want to make Buttons with different transparency levels in android.I have used \"@android:color/transparent\"
. But it makes the button 100% transparent. I need a
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)