Context#getResources().getDrawable()方法过时后的替代方法
2016-07-01 15:23
357 查看
博客源址:http://www.jianshu.com/p/e22d9dd93d4a
参考:Android
getResources().getDrawable() deprecated API 22
1)使用drawable资源但不为其设置theme主题ResourcesCompat.getDrawable(getResources(), R.drawable.name, null);
2)使用默认的activity主题
ContextCompat.getDrawable(getActivity(), R.drawable.name);
3)使用自定义主题
ResourcesCompat.getDrawable(getResources(), R.drawable.name, anotherTheme);
相关文章推荐
- 九种编程语言大对比
- 表格中用Jquery获取双击行的某列的值
- web开发中多线程下载文件
- iOS库 .a与.framework区别
- 保存图片到指定相册 支持创建新相册
- Android使用binder访问service的方式(一)
- memory leak checking for android
- Phaser-学习记录
- listview滚动到底部可以继续加载,结合json解析
- mysql索引总结
- 35 个 Java 代码性能优化总结
- 复制mysql数据库的步骤
- http幂等性
- AndroidStudio十佳常见编译或运行错误集锦
- [perl] CPAN, cpanm, perlbrew, local::lib 使用初步
- Redis 配置文件详解
- 高德地图---显示/定位/POI搜索/大头针/气泡
- 实习杂记(27):android的touch Mode
- SSH配置远程主机信任
- 直接插入排序