'getColor(int)' is deprecated ,getColor过时
来源:互联网 发布:人工智能技术瓶颈 编辑:程序博客网 时间:2024/05/17 04:01
'getColor(int)' 在API 23(6.0)已经过时了
6.0之后使用:
ContextCompat.getColor(context, R.color.color_name)
例如:
textView.setTextColor(ContextCompat.getColor(this, R.color.colorPrimary));
源码:
@ColorInt public static final int getColor(Context context, @ColorRes int id) { final int version = Build.VERSION.SDK_INT; if (version >= 23) { return ContextCompatApi23.getColor(context, id); } else { return context.getResources().getColor(id); } }可以看出替代方法是兼容高版本和低版本的。
阅读全文
1 0
- 'getColor(int)' is deprecated ,getColor过时
- getColor(int id) is deprecated
- getDrawable(int id) getColor(int id) is deprecate 已过时
- getColor(int id)在API23时过时
- Android getResource().getColor(int)过时解决方法
- getColor(int id)在API23过时问题
- GetColor
- AndroidStudio getColor方法过时
- getColor过时方法替代
- getResources().getColor() deprecated
- 【Android】getColor(int id)在API23时过时
- getResources().getColor(R.color.color_name) is deprecated和drawableTop
- Android getColor方法提示过时
- android-6.0-23的getColor过时
- android-6.0-23的getColor过时
- getDrawable,getColor 过时的替代方法
- getColor方法在6.0中已经过时
- Android 6.0 的getColor()方法过时
- 正则表达式30分钟入门教程
- spring 随手笔记
- 白话算法之【动态规划入门】
- opencv Mat IplImage CvScalar
- 数据结构—4字母加密
- 'getColor(int)' is deprecated ,getColor过时
- Spring学习2——【转】什么是IoC
- LeetCode 217. Contains Duplicate
- oracle last_day()函数,返回当月最后一天,即 last_day(date)
- Linux(ubuntu/Centos) 使用Tomcat 部署Java项目 附带安装JDK+数据库
- 按索引index取出指定位置泛型字典Dictionary的key和value的方法举例
- gethostbyname获得相应域名的IP
- 解决《用Python写网络爬虫》中示例网站访问不了的问题
- 剑指offer:第46题计算1+2+3+……+n;