版权声明:转载请声明: https://blog.csdn.net/MingJieZuo/article/details/82851584
一、目录
在开发中经常会遇到一些过期的方法,但替换方法总是记不住,索性就写篇博客记录一下了
- getResources().getColor(int)
二、详情
getResources().getColor(int)方法过期方法与替代方法展示
// 过期方法
progressBar.setBackgroundColor(getResources().getColor(R.color.my_player_progress_bar_bg));
// 替代方法
progressBar.setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.my_player_progress_bar_bg));