[英]ImageView loading high resolution image as very poor quality
我使用ListFragment
使用Android通用图像加载器显示Lazy Loaded ImageView
对象的ListView
。 正确的数据来自我的数据源,我有相当高分辨率图像的URL(大约1000px宽,150kb)。 我正在使用它们来完全填充110dp高的每一行。
我遇到的问题是图像加载的分辨率非常低:
问题不是源图像,因为它的质量足够高:
http://www.puc.edu/__data/assets/image/0006/127581/IMG_5155.jpg
我将图像居中,然后裁剪它:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="110dp">
<TextView
android:id="@+id/galleryTitle"
android:layout_width="wrap_content"
android:layout_height="80dp"
android:layout_marginLeft="95dp"
android:layout_marginRight="5dp"
android:gravity="center_vertical"
android:hint="16dp"
android:lineSpacingExtra="0dp"
android:lines="3"
android:text="TextView"
android:textSize="16sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/galleryImageView"
android:layout_width="fill_parent"
android:layout_height="110dp"
android:scaleType="centerCrop"
android:src="@drawable/default_background" />
</RelativeLayout>
在行中显示图像:
public View getView(int position, View convertView, ViewGroup parent) {
View itemView;
TextView title;
// Get the news item object
PUCObjects.PUCPhotoGalleryItem item = items.get(position);
// Inflater Service
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
itemView = inflater.inflate(R.layout.photos_gallery_row, parent, false);
title = (TextView) itemView.findViewById(R.id.galleryTitle);
ImageView imageView = (ImageView) itemView.findViewById(R.id.galleryImageView);
// Set the Image
imageLoader.DisplayImage(item.imageUrlExtraLarge, imageView);
// Set the text
title.setText(item.title);
return itemView;
}
任何想法为什么它显示如此糟糕的分辨率图像?
图片似乎缩小了比例。 查看该库,默认功能是2图像采样的功能。 我认为这是你问题的根源。
例如:
DisplayImageOptions opts = new DisplayImageOptions.Builder().imageScaleType(ImageScaleType.NONE).build();
imageLoader.DisplayImage(item.imageUrlExtraLarge, imageView, opts);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.