的TableRow的设置背景颜色 [英] Set background color of TableRow
本文介绍了的TableRow的设置背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试设置的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)
这篇关于的TableRow的设置背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文