1、设置组件大小
LayoutParams layoutParams = mImgIcon.getLayoutParams();
layoutParams.width = mImageW;
layoutParams.height = mImageW;
2、设置margin
LinearLayout.LayoutParams layoutParams =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParams.setMargins(0,ScreenUtils.dip2px(this, 10),0,0);//4个参数按顺序分别是左上右下
view.setLayoutParams(layoutParams);