我正在使用动态布局,我想设置ImageView
. 代码如下。如何ImageView
在给定布局中设置高度和宽度?非常感谢任何帮助。
RelativeLayout layout = new RelativeLayout(mContext);
TextView text1 = new TextView(mContext);
text1.setText(Constants.vctrCategory.elementAt(counter).toString());
LayoutParams params1 = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
params1.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
text1.setLayoutParams(params1);
text1.setTextSize(20);
layout.addView(text1);
ImageView image = new ImageView(mContext);
image.setImageBitmap(bitmap);
layout.addView(image);
counter++;
return layout;