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
Instead of this:
android:color="#66FF0000" // Partially transparent red
android:alpha="0.25" // 25% transparent
you can use this:
android:background="#00FFFFFF"
Setting the android:alpha
property for button will help...
Set the colour you want and then set the alpha property.
android:color="#e5e5e5"
android:alpha="0.25"
0.25 means 25%
try adding this to your button android:color="#55000000""
<Button android:id="@+id/three" android:text="@string/dtmf_3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:color="#55000000" <!--Here--!>
android:textColor="@color/white" ></Button>
You can try setting
android:alpha="0.7"
property on your Button in xml layout file
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
Try android:background="#70FF0000"
in your button code. Works for me.