我尝试设置的TableRow的背景颜色。 目前我有这在我的XML文件:
I try to set the background color of a TableRow. Currently I have this in my XML file:
android:background="@color/buttonBackground"
和我的工作很大。但是,当它运行
and i work great. But when it run
row.setBackgroundColor(R.color.red);
该行消失。一个人能解释这是为什么?
the row disappears. Can someone explain why that is?
我相信你需要做的:
Resources resource = context.getResources();
row.setBackgroundColor(resource.getColor(R.color.red)