setCompoundDrawablePadding位置問題

Drawable drawable = context.getResources().getDrawable(R.drawable.icon_mian);
drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
groupViewHolder.deliverTip.setCompoundDrawablePadding(26);
groupViewHolder.deliverTip.setCompoundDrawables(drawable, null, null, null);

這樣寫是隻有圖片和文字之間的間距java

Drawable drawable = context.getResources().getDrawable(R.drawable.icon_mian);
drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
groupViewHolder.deliverTip.setCompoundDrawables(drawable, null, null, null);
groupViewHolder.deliverTip.setCompoundDrawablePadding(26);

這樣寫圖片左右間距都有效果code

相關文章
相關標籤/搜索