Skip to content Skip to sidebar Skip to footer

Making A Android Button’s Background Translucent,

Is there a way to make an android button’s background translucent within xml code, So the button has no background drawable?

Solution 1:

android:background="@android:color/transparent" 

You can also set your own colors:

android:background="#80000000"

The first two hex characters represent opacity. So #00000000 would be fully transparent. #80000000 would be 50% transparent. #FF000000 is opaque.

The other six values are the color itself. #80FF8080 is a color I just made up and is a translucent sort of pinkish.


Solution 2:

The best way is to create a selector.


Solution 3:

Set the background to the standard android transparent color.

In Code:

myButton.setBackground(getResources().getColor(android.R.color.transparent));

In xml:

android:background="@android:color/transparent"

Post a Comment for "Making A Android Button’s Background Translucent,"