美文网首页
Context#getResources().getDrawab

Context#getResources().getDrawab

作者: BlackNeko | 来源:发表于2016-05-18 16:08 被阅读4248次

参考: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().getDrawab

      本文链接:https://www.haomeiwen.com/subject/vsewrttx.html