xml设置drawableLeft,drawableRight,drawableTop,drawableBottom
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/sp_14"
android:textColor="@color/c_999999"
android:drawableLeft="@drawable/icon_check_flase"
android:drawableRight="@drawable/icon_check_flase"
android:drawableTop="@drawable/icon_check_flase"
android:drawableBottom="@drawable/icon_check_flase"/>
代码中设置
Drawable drawable = mContext.getResources().getDrawable(R.drawable.icon_check_true);
drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
tv_card_two_share.setCompoundDrawables(drawable, null, null, null);
drawable.setBounds(int left, int top, int right, int bottom);这个方法必须要加,否则drawable会不显示;
setCompoundDrawables(Drawable left, Drawable top,Drawable right, Drawable bottom); //左 上 右 下