1.getResources().getColor()方法過時(shí)
ContextCompat.getColor(context, R.color.black);
2.getResources().getDrawable()方法過時(shí)
(1).使用drawable資源但不為其設(shè)置theme主題
ResourcesCompat.getDrawable(getResources(), R.drawable.name, null);
(2).使用默認(rèn)的activity主題
ContextCompat.getDrawable(getActivity(), R.drawable.name);
(3).使用自定義主題
ResourcesCompat.getDrawable(getResources(), R.drawable.name, anotherTheme);