我正在使用动态布局我想要设置宽度和高度ImageView
。代码如下。如何在给定的布局中设置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;
我不明白...你只需在TextView上设置LayoutParams,为什么你不能在ImageView上做同样的事情? – Sam
我设置了imageview,但不显示。 – rameesha