1.getResources().getColor()方法过时
ContextCompat.getColor(context, R.color.black);
2.getResources().getDrawable()方法过时
(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);