显示ImageView的大图 [英] Display big image in ImageView
问题描述
如果我选择的大画面,如<一个href=\"http://www.google.ru/imgres?imgurl=http://www.lakeshore$p$pserve.wisc.edu/photo-gallery/bigwoods/lg/Big%2520Woods%2520Aerial,%2520Cronon,%2520DSC_8790.jpg&imgrefurl=http://www.lakeshore$p$pserve.wisc.edu/visit/bigwoods.htm&h=2000&w=3008&sz=1574&tbnid=bUYyrcldF3GAxM%3a&tbnh=93&tbnw=140&zoom=1&usg=__-V3U-FJCCA-NOTpk-Tzk4psH_68=&docid=GhTYWqNlIbdBnM&sa=X&ei=gHqFUfigHcWk4gSthoGoCQ&ved=0CEIQ9QEwBA&dur=279\"相对=nofollow>它是从画廊,并尝试在ImageView的显示它的ImageView的将不显示。
If I choose the big picture such as it is from Gallery and try display it in ImageView, the ImageView will not display it.
public class ColorViewerActivity extends Activity {
// SKIP OTHER METHODS
private static final int SELECT_PHOTO_REQUEST = 100;
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.open_image:
selectImage();
break;
}
return true;
}
private void selectImage() {
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
photoPickerIntent.setType("image/*");
startActivityForResult(photoPickerIntent, SELECT_PHOTO_REQUEST);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) {
super.onActivityResult(requestCode, resultCode, imageReturnedIntent);
switch(requestCode) {
case SELECT_PHOTO_REQUEST:
if (resultCode == RESULT_OK) {
Uri imageUri = imageReturnedIntent.getData();
ImageView imageView = (ImageView) findViewById(R.id.imageView);
imageView.setImageURI(imageUri);
}
}
}
}
为什么?由于图片太大?
Why?? Because the image is too big?
对不起,我的英语水平。
Sorry for my English.
感谢
推荐答案
如果您使用的超过了你的记忆巨大的图像会抛出
If you use huge image which exceeds your memory it will Throw
java.lang.OutofMemoryError:位图的大小超过VM预算
java.lang.OutofMemoryError: bitmap size exceeds VM budget.
要知道如何显示位图有效检查此链接
To know how to display bitmaps efficiently check this link
这篇关于显示ImageView的大图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!