AndroidのURLから画像を取得し、に設定しようとしていますImageView
。私がしていることは次のとおりです。
image = new ImageView(mContext);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(MY_WIDTH, MY_HEIGHT);
params.leftMargin = lefMargin;
params.topMargin = topMargin;
image.setImageBitmap(BitmapFactory.decodeStream((InputStream)new URL(MY_URL).getContent());
relativeLayout.addView(image, params);
しかし、画像は私のサイズ(MY_WIDTH、MY_HEIGHT)に適合していません。それは、独自のサイズで表示されます。何をすべきか?