我目前的嘗試:設置固定的大小和樣式繪製每個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
,而不是兩者。
使用此圖像view.setLayoutParams(new LayoutParams(width,height)); – mayuri