getColor方法在6.0中已经过时

来源:互联网 发布:盘古网络招聘 编辑:程序博客网 时间:2024/05/17 00:08
getColor方法在6.0中已经过时

可以参考以下方法:

ContextCompat.getColor(context, R.color.my_color)



具体使用是:

private TextView tv_buy;tv_buy = (TextView) findViewById(R.id.tv_buy);//tv_buy.setTextColor(this.getResources().getColor(R.color.green));//已经过时tv_buy.setTextColor(ContextCompat.getColor(this,R.color.green));//替代已过时getColor




详细内容请看文章:http://blog.csdn.net/explorerqp/article/details/48546093
1 0
原创粉丝点击