2016-03-17 75 views
1

我有一个带drawableTop的按钮,有没有办法更改drawableTop图像的高度和宽度,我可以更改drawableTop的填充而不是高度或宽度,任何建议都要提前感谢。如何更改drawableTop图像大小

<Button 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:gravity="center" 
    android:drawableLeft="@drawable/inventory_Icon" 
    android:text="Inventory"/> 
+0

你试过我的解决方案? –

回答

0

你需要像下面这样做。

Drawable drawable = context.getResources().getDrawable(id); 
drawable.setBounds(0, 0, 30, 30); 
yourTextView.setCompoundDrawables(drawable, null, null, null); 

完成