【发布时间】:2016-09-11 14:45:27
【问题描述】:
imgView.setImageTintList(getResources()
.getColorStateList(R.color.my_clr_selector));
上面写着“调用需要 API 级别 21”。
如何让它在 API 21 以下的 Android 设备上运行?
我可以使用ImageView#setColorFilter() 使其工作,但我更喜欢使用ColorStateList 来设置色调。
【问题讨论】:
-
使用
DrawableCompat#setTintList() -
@pskink 但不推荐使用 getResources().getColorStateList
-
你不知道用什么代替?
标签: android android-support-library