我正在使用 ListFragment
来显示延迟加载的 ImageView
对象的 ListView
,使用 Android Universal Image Loader .正确的数据来 self 的数据源,我有我相当高分辨率的图像(大约 1000 像素宽,150kb)的 URL。我正在使用它们来完全填充 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);
关于android - ImageView 加载高分辨率图像质量很差,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25071007/