[英]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.