顯示它後得到位圖的大小有一個imageview的我如何在ImageView的
<ImageView
android:id="@+id/imgCaptured"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="@drawable/captured_image" />
我從相機捕獲圖像,轉換該圖像爲位圖。
Bitmap thumbnail;
thumbnail = MediaStore.Images.Media.getBitmap(getActivity()
.getContentResolver(), imageUri);
,當我在上面的ImageView顯示它之前獲得此位圖的分辨率一樣,
Log.i("ImageWidth = " + thumbnail.getWidth(), "ImageHeight = "
+ thumbnail.getHeight());
其返回我在此之後ImageWidth = 2592 ImageHeight = 1936
我顯示此位圖在我上面的ImageView爲imgCaptured.setImageBitmap(thumbnail);
然後我去我的imageview的大小爲
Log.i("ImageView Width = " + imgCaptured.getWidth(),
"ImageView Height = " + imgCaptured.getHeight());
這回我ImageView Width = 480 ImageView Height = 720
現在我的問題是,
如何才能得到該位圖的大小後,我的ImageView顯示它。 我知道這可以通過使用此
image.buildDrawingCache(); Bitmap bmap = image.getDrawingCache();
進行,但是這將創建大小相等的ImageView的新位圖。
我也想知道,圖像在imageview中顯示後是否自動調整大小。如果是的話,有沒有什麼辦法可以在imageview中顯示圖片而不用調整圖片大小。
編輯
其實我已經捕獲的2592x1936的圖像。我在我的imageView中顯示了這個圖像,在這個圖像上做了一些其他操作。現在我想用相同的2592x1936分辨率保存此圖像。可能嗎?
在此先感謝。
繪製要clarify-你的意思是在圖像視圖中位圖的大小寬度和高度?如果沒有填充,則兩者是等效的,ImageView的寬度/高度是位圖的寬度/高度。如果你有填充,就把它減掉。 – 2013-02-28 05:40:16
是的,我的意思是在imageview中顯示它之後的位圖大小。 – 2013-02-28 05:42:58
@Gabe Sechan其實我已經拍下了2592x1936的圖片。我在我的imageView中顯示了這個圖像,在這個圖像上做了一些其他操作。現在我想用相同的2592x1936分辨率保存此圖像。可能嗎? – 2013-02-28 05:47:36