從URL加載時,我有我在我的佈局創造了一個ImageView的在我的Android應用程序形象的Android
從URL裝入的圖像此的要求裝入小尺寸。以下是ImageView的
<ImageView
android:id="@+id/MyImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_gravity="center_horizontal">
</ImageView>
然後在我的代碼我用下面這個ImageView的
ImageView bmImage = (ImageView)this.findViewById(R.id.MyImage);
String urldisplay = urls[0];
Bitmap mIcon11 = null;
try {
InputStream in = new java.net.URL(urldisplay).openStream();
mIcon11 = BitmapFactory.decodeStream(in);
} catch (Exception e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
bmImage.setImageBitmap(mIcon11);
是躺在我的URL路徑上的圖像來加載圖像尺寸爲320×50。但非常奇怪的是,當圖像顯示在ImageView中時,尺寸變得非常小,幾乎是寬度和高度的一半
我嘗試了很多,但沒有解決方案。任何人都可以幫忙嗎?
這是什麼的ImageView在佈局的父這個配置?你有沒有嘗試設置ImageView的'scaleType'屬性? – acj