设置textView周围的图片

布局的
<TextView android:drawableLeft="@drawable/icon"></TextView

代码的
Drawable leftDrawable;
Resources res = getResources();
leftDrawable= res.getDrawable(R.drawable.left_drawable);
// user setCompoundDrawables() method , you must call Drawable.setBounds() method !Or the Image can't show .
leftDrawable.setBounds(0, 0, leftDrawable.getMinimumWidth(), leftDrawable.getMinimumHeight());
mTextView.setCompoundDrawables(leftDrawable, null, null, null);

原文地址:https://www.cnblogs.com/zhenbeiju/p/2622239.html