我有一個圖像,我從我的android應用程序從互聯網上下載。我不希望這個圖像被調整/縮放。無論如何,我可以阻止圖像被縮放?防止Android應用程序中的圖像縮放
下面是ImageView的我的XML項:
<ImageView
android:id="@+id/conditionImage"
android:scaleType="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/textMain"
android:contentDescription="@string/noaaLogoDescription" />
這裏是我的顯示圖像視圖其代碼:
BitmapFactory.Options bmpOptions = new Options();
bmpOptions.inScaled = false;
URL url = new URL("URLPATHTOIMAGE");
ImageView conditionImageView = (ImageView)findViewById(R.id.conditionImage);
InputStream content = (InputStream)url.getContent();
conditionImage = BitmapFactory.decodeStream(content, null, bmpOptions);
conditionImageView.setImageBitmap(conditionImage);
我試圖在ImageView的XML元素改變scaleType使用矩陣,中心和centerInside。我最後一次嘗試使用上面的代碼將inScale設置爲false。有沒有人有任何其他想法?
奇怪的是這不是在模擬器中發生的。
圖像仍然縮放。另一個煩人的部分,它在模擬器中正常工作,但在實際的4.2設備(Samsung Galaxy S4)上縮放。 – 2013-04-29 16:33:03
請參閱新的編輯。 – Neoh 2013-04-29 16:39:39
剛剛嘗試過新的編輯,仍在縮放。 – 2013-04-29 17:56:37