通过java/kotlin代码设置颜色时经常看到getColor(颜色值)在6.0以后被弃用的提示吧!如图1,只需要将resources替换成ContextCompat.getColor(context,颜色值)如:图2