【发布时间】:2017-09-12 02:00:58
【问题描述】:
一个非常常见的问题,我找不到解决方案。 我正在以编程方式设置我的向量。我也希望能够以编程方式更改色调颜色。 找到了一些解决方案,例如 Programmatically tint a Support Vector
ImageView iv = ....
Drawable d = VectorDrawableCompat.create(getResources(), R.drawable.ic_exit_to_app_24dp, null);
d = DrawableCompat.wrap(d);
DrawableCompat.setTint(d, headerTitleColor);
iv.setImageDrawable(d);
主要问题来自于
iv.setImageDrawable(d);
我发现 prelolipop 只接受设置视图的可绘制对象
iv.setImageResource(int resource)
我找不到任何使用可绘制文件设置它的解决方案。
【问题讨论】:
标签: android vector drawable android-resources