private void setLinearLayoutParams(View imageView) {
if (mScreenSize == 0 )
mScreenSize = getScreenSize();
int width = ViewGroup.LayoutParams.MATCH_PARENT;
int height = 0;
if (mScreenSize <= 7)
height = LayoutConstants.sVerVideoImgHeight + 165;
else
height = LayoutConstants.sVerVideoImgHeight + 115;
ViewGroup.LayoutParams params = imageView.getLayoutParams();
if (params == null) {
params = new ViewGroup.LayoutParams(width, height);
imageView.setLayoutParams(params);
} else {
params.width = width;
params.height = height;
}
}
动态根据weight添加
LinearLayout.LayoutParams paramsItemView = new LinearLayout.LayoutParams(
0,
ViewGroup.LayoutParams.WRAP_CONTENT, 1);
LinearLayout.addView(convertView,paramsItemView);