Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试更改代码中按钮的颜色,如下所示
btn_no5.setTextColor(0x8E35EF);
上述更改没有反映(紫色),执行上述代码后文本消失。但是如果我在 xml 中使用它的反射颜色。那么如何通过 java 来改变呢?
您使用的颜色是完全透明的。请改用 0xFF8E35EF。第一个字节是 alpha(透明度)通道。
像这样使用,
btn_no5.setTextColor(Color.parseColor("#8E35EF"));