你可以使用该
setCompoundDrawables方法执行此操作。请参阅此处的示例。我在不使用的情况下使用了
setBounds它,并且效果很好。你可以尝试任何一种方式。
更新:如果链接断开,请在此处复制代码
Drawable img = getContext().getResources().getDrawable(R.drawable.smiley);img.setBounds(0, 0, 60, 60);txtVw.setCompoundDrawables(img, null, null, null);
要么
Drawable img = getContext().getResources().getDrawable(R.drawable.smiley);txtVw.setCompoundDrawablesWithIntrinsicBounds(img, null, null, null);
要么
txtVw.setCompoundDrawablesWithIntrinsicBounds(R.drawable.smiley, 0, 0, 0);



