1,在xml中配置使用,android:drawableLeft 等
其它的有:android:drawableTop,android:drawableBottom,android:drawableRight,android:drawableStart,android:drawableEnd,android:drawablePadding
<TextView
android:id="@+id/alphaset"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:drawableLeft="@drawable/ic_launcher"
android:alpha="1"
android:background="#CDB5CD"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:text="a"/>
2,在代码中使用 View.的 setCompoundDrawables (Drawable left, Drawable top, Drawable right, Drawable bottom);
Drawable drawable= content.getResources().getDrawable(itemData.mMsgIcon);
/// 这一步必须要做,否则不会显示.
drawable.setBounds(, , drawable.getMinimumWidth(), drawable.getMinimumHeight());
content.setCompoundDrawables(drawable,null,null,null);