2016-03-17 73 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); 

完成