Android SDK 升級到23后
问题:
getResource.getColor(R.color.color_name),getResources().getDrawable(R.drawable.drawable_name)过时不推荐使用;
解决方法:
使用新加入的方法ContextCompat.getColor(context,R.color.color_name)和 ContextCompat.getDrawable(this,R.R.drawable.drawable_name) 。
getDrawable()getColor()和方法过时的替代方法
最新推荐文章于 2023-07-30 14:35:20 发布