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);

这样写是只有图片和文字之间的间距

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);

这样写图片左右间距都有效果

你可能感兴趣的:(setCompoundDrawablePadding位置问题)