0

这是我用来调整drawable大小的代码:

Drawable drawable = model_btn.getCompoundDrawables()[0];


        drawable.setBounds(0, 0, (int) (height * 0.065),
                (int) (height * 0.065));


        ScaleDrawable sd = new ScaleDrawable(drawable, 0, 50, 50);

如果我使用

model_btn.setCompoundDrawables(sd.getDrawable(), null, null, null);

可绘制的左侧未显示。

如果我使用:

  model_btn.setCompoundDrawablesWithIntrinsicBounds(sd.getDrawable(), null, null, null);

它显示了可绘制的左侧,但没有调整大小。

感谢您的建议。

4

1 回答 1

0

你可以试试这个

model_btn.setCompoundDrawablesWithIntrinsicBounds( R.drawable.id, 0, 0, 0);
于 2016-02-22T06:43:57.987 回答