【发布时间】:2014-09-24 02:42:24
【问题描述】:
我正在使用ListFragment 显示使用Android Universal Image Loader 的延迟加载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;
}
知道为什么它会显示分辨率如此低的图像吗?
【问题讨论】:
标签: android android-studio android-imageview android-listfragment universal-image-loader