Android 之'getResources().getColor(int)' 已经过时了

'getColor(int)' 已经过时了 less... (Ctrl+F1) 
不能使用过时的类或方法。 说明:java.net.URLDecoder 中的方法decode(String encodeStr) 这个方法已经过时,应该使用双参数decode(String source, String encode)。接口提供方既然明确是过时接口,那么有义务同时提供新的接口;作为调用方来说,有义务去考证过时方法的新实现是什么。

换个最新官方推荐的方法:

textView.setTextColor(ContextCompat.getColor(mContext,R.color.black))

两个参数,一个是上下文,一个是颜色。

猜你喜欢

转载自blog.csdn.net/qq_31622345/article/details/104922176