开发者

Button set Background to Transparent Color

开发者 https://www.devze.com 2023-01-07 10:14 出处:网络
How can I set the Background for a button to a transparent Color, like transparent Blue for eg, instead of a solid blue?

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开发者_C百科 solid blue.


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));
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号