3

How can I set the Background for a button to a transparent Color, like transparent Blue for eg, instead of a solid blue?

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

Reno
  • 33,594
  • 11
  • 89
  • 102
Chris
  • 545
  • 1
  • 10
  • 17

1 Answers1

5

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

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

button.setBackgroundColor(Color.argb(125, 0, 0, 255));
Federico klez Culloca
  • 26,308
  • 17
  • 56
  • 95