android中得到颜色,图片资源的方式

button01.setBackgroundColor(getResources().getColor(R.color.red));

color.xml

colors.xml

<?xml version="1.0" encoding="UTF-8"?>
<resources>
    <color name="red">#f00</color>
    <color name="green">#0f0</color>
    <color name="blue">#00f</color>
    <color name="black">#000</color>
</resources>


posted @ 2014-07-03 12:35  developer_Kale  阅读(373)  评论(0编辑  收藏  举报
网站流量统计工具