[英]Set fixed size and drawable style for each ImageView
我目前的尝试:
ImageView imageview = new ImageView(this);
imageview.setImageDrawable(getResources().getDrawable(R.drawable.nice_style));
URL url = new URL("url_of_the_photo");
Bitmap bmp = BitmapFactory.decodeStream(url.openConnection().getInputStream());
imageview.setImageBitmap(bmp);
linear_layout.addView(imageview);
不使用nice_style
,我不确定如何为每个imageview应用固定大小。 我尝试添加LinearLayout.LayoutParams
,但只能设置width
或height
,不能同时设置两者。
用它来赋予imageview高度和宽度。
imageview.setLayoutParams(new LayoutParams(width, height));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.