Context#getResources().getDrawable()方法过时后的替代方法
2017-04-12 23:14
363 查看
参考: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);
相关文章推荐
- Context#getResources().getDrawable()方法过时后的替代方法
- getDrawable过时的替代方法
- 好用的 Android getDrawable过时的替代方法
- getResource().getDrawable() 方法过时替代方法
- Android的getColor,getDrawable过时的替代方法
- getResources().getDrawable()方法过时的替代方法
- getResources().getDrawable()方法过时后的替代方法
- getDrawable,getColor 过时的替代方法
- getDrawable,getColor 过时的替代方法
- getDrawable过时的替代方法
- getDrawable过时的替代方法
- (转)getDrawable过时的替代方法
- getDrawable过时的替代方法
- android context.getResources()方法的过时替换
- getDrawable过时的替代方法
- getDrawable()getColor()和方法过时的替代方法
- getDrawable()方法过时 替代
- getDrawable过时替代方法
- 获取图片资源过时方法替换:getResources().getDrawable(R.drawable.img);替换
- Android中getDrawable和getColor过时的替代方法