【发布时间】:2017-07-12 17:04:51
【问题描述】:
我在我的 android 项目中动态显示了一些 VectorDrawable 图标。 但是,我无法使用以下代码缩放 java 层中的图标:
VectorDrawable jDrawable = (VectorDrawable) getContext().getDrawable(nResourceID);
// resize the icon
jDrawable.setBounds(30, 30, 30, 30);
// set the icon in the button view
button.setCompoundDrawablesRelativeWithIntrinsicBounds(jDrawable, null, null, null);
注意:Android how to resize (scale) an xml vector icon programmatically的答案并没有解决我的问题。
【问题讨论】:
-
你误会了!抱歉不完整。
标签: java android android-vectordrawable