Java Android背景色不工作
androidJava Android背景色不工作,java,android,colors,Java,Android,Colors,androidsetBackgroundColor()一直在破坏我的应用程序 View vyoo = (View) v.getParent(); Button h = (Button) v.findViewById(R.id.hateButton); Button r = (Button) v.findViewById(R.id.rateButton); h.setBackgroundColor(Color.parseColor("#FF70AA")); 我已经试过了 h.setTex
setBackgroundColor()
一直在破坏我的应用程序
View vyoo = (View) v.getParent();
Button h = (Button) v.findViewById(R.id.hateButton);
Button r = (Button) v.findViewById(R.id.rateButton);
h.setBackgroundColor(Color.parseColor("#FF70AA"));
我已经试过了
h.setText("hello");
然而,这是有效的尝试getResources().getColor(R.color.colorname);
在ur values/colors.xml文件中定义颜色,如下所示
<color
name="color_name"
>hex_color</color>
hex\u颜色
崩溃日志或stacktrace说明了什么?