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.
button.setBackgroundColor(Color.BLUE)
You can use Color.argb () . It accepts four parameters int, each ranging from 0 to 255.
int
Let's say you need a blue button with 50% alpha:
button.setBackgroundColor(Color.argb(125, 0, 0, 255));