问题:resource.getcolor()和resource.getDrawable()被摒弃用什么代替
方法:ContextCompat.getDrawable(this,R.drawable.bg_transparent)
;ContextCompat.getDrawable(this,R.color.red)
其中this是在activity中用的,在fragment中用
context?.let { ContextCompat.getColor(it,R.color.teal) }
resource.getcolor()和resource.getDrawable()被摒弃用什么代替
最新推荐文章于 2024-02-25 11:47:59 发布