方案A (推荐):
获取带主题属性的drawable,主题配置来自当前Activity:
1
ContextCompat.getDrawable(getActivity(), R.drawable.name);
方案B:
获取不带主题属性的drawable:
1
ResourcesCompat.getDrawable(getResources(), R.drawable.name, null);
方案C:
获取带自定义主题属性的drawable:
1
ResourcesCompat.getDrawable(getResources(), R.drawable.name, anotherTheme);