android按钮背景颜色函数,Android按钮背景颜色(Android button background color)

  • Post author:
  • Post category:其他


Android按钮背景颜色(Android button background color)

我想在我的应用程序中设置按钮的背景颜色,我无法实现我想要的结果…

我试图设置的颜色是holo_green_light(#ff99cc00) 。 为了做到这一点,我使用setColorFilter(0xff99cc00, PorterDuff.Mode.MULTIPLY);

我得到的颜色不是holo_green_light而是lightgrey和holo_green_light的混合。

我已经尝试使用LightingColorFilter但没有取得太大的成功。

有没有办法以编程方式做到这一点,使按钮看起来像一个按钮,而不是一个平面矩形与我需要的颜色。

I am trying to set the background color of a button in my app and I am unable to achieve the result that I want…

The color that I am trying to set is holo_green_light(#ff99cc00). In order to do it, I am using setColorFilter(0xff99cc00, PorterDuff.Mode.MULTIPLY);

The color that I get is not the holo_green_light but a mix of lightgrey and holo_green_light.

I have tried using the LightingColorFilter without much success.

Is there a way to do it programatically, so that the button appears like a button and not a flat