最佳答案
通过编程方式设置机器人 TextView
的背景颜色似乎不起作用。
我漏掉了什么!
TextView et = new TextView(activity);
et.setText("350");
et.setBackgroundColor(R.color.white);
我的 res/value 文件夹中还有这个文件(lors.xml)
<resources>
<color name="white">#ffffffff</color>
<color name="black">#ff000000</color>
</resources>
[编辑] : 此外,设置文本颜色会导致 TextView 消失。
TextView c1 = new TextView(activity);
c1.setTextColor(R.color.solid_red);
c1.setText("My Text");