Background buttons set for transparent color

How to set the background for a button to a transparent color, for example, transparent blue, for example, instead of solid blue?

When I use button.setBackgroundColor(Color.BLUE), it sets it to blue.

+3
source share
1 answer

You can use Color.argb () . It accepts four parameters int, each ranging from 0 to 255.

Let's say you need a blue button with 50% alpha:

button.setBackgroundColor(Color.argb(125, 0, 0, 255));
+5
source

All Articles