布局的
<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);