第一个:设置图片大小的,特别在adapter中,图片大小要动态改变的时候
ViewGroup.LayoutParams params = imageview.getLayoutParams();
params.height = DensityUtil.dip2px(ctx, 28.0f);
params.width = DensityUtil.dip2px(ctx, 28.0f);
imageview.setLayoutParams(params);
第二个:为textview 设置drawable
Drawable leftDrawable = getResources().getDrawable(R.drawable.loaction);
Drawable rightDrawable = getResources().getDrawable(R.drawable.choose_more);
leftDrawable.setBounds(0, 0, DensityUtil.dip2px(this, 15), DensityUtil.dip2px(this, 20));
rightDrawable.setBounds(0, 0, DensityUtil.dip2px(this, 16), DensityUtil.dip2px(this, 8));
tvAddressName.setCompoundDrawables(leftDrawable, null, rightDrawable, null);
tvAddressName.setCompoundDrawablePadding(8);