ImageView的装载高分辨率图像的质量非常差 [英] ImageView loading high resolution image as very poor quality

本文介绍了ImageView的装载高分辨率图像的质量非常差的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 ListFragment 显示懒的的ListView 加载的ImageView 使用 Android的通用图像装载机对象。正确的数据是从我的数据源快到了,我知道该网址,我非常高分辨率的图像(约1000像素宽,150KB)。我使用这些完全填充每一行是110dp高。

I am using a ListFragment to display a ListView of Lazy Loaded ImageView objects using the Android Universal Image Loader. The correct data is coming from my datasource and I have the URL to my fairly high resolution images (about 1000px wide, 150kb). I am using these to completely fill each row that is 110dp high.

我遇到的问题是图像加载在一个非常差的分辨率:

The problem I am having is the images are loading at a very poor resolution:

问题是与源图像,因为它是足够高品质的:

The problem isn't the source image as it is high enough quality:

http://www.puc.edu/__data/资产/图像/ 0006/127581 / IMG_5155.jpg

我定心图像,然后裁剪它:

I am centering the image and then cropping it:

<?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>

显示图像的行中:

Displaying the image in the row:

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图像采样的力量。我估计这是你的问题的根源。

The pictures appear to be down scaled. Looking at that library the default functionality is power of 2 image sampling. I would reckon this is source of your issue.

  • ImageScaleType
  • DisplayOptions

例如:

DisplayImageOptions opts = new DisplayImageOptions.Builder().imageScaleType(ImageScaleType.NONE).build();

imageLoader.DisplayImage(item.imageUrlExtraLarge, imageView, opts);

这篇关于ImageView的装载高分辨率图像的质量非常差的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆