有人可以告诉我为什么即使从 Droidfu 缓存中抓取图像,这个 GridView 也不能平滑滚动?
我已经尝试过 WebImageView,我自己的带有 ImageLoader 的默认处理程序,删除了 sqlLite 调用并只使用了静态 URL,尝试在加载后隐藏和淡入图像等。似乎无法平滑滚动(变得急躁)。是 DroidFu 造成的吗?我不想抛弃 Droidfu,因为我已经投资了它。显然本地图片资源插入到 GridView 滚动很好。我在这个问题上花了太长时间。
public View getView(int position, View convertView, ViewGroup parent) {
mCursor.moveToPosition(position);
String thumbUrl=imagePath+mCursor.getString(mCursor.getColumnIndex("imagename"));
if (convertView == null) {
convertView=(View)mInflater.inflate(R.layout.grid_thumb_layout, null);
}
WebImageView thumb=(WebImageView)convertView.findViewById(R.id.thumb);
thumb.reset();
thumb.setImageUrl(thumbUrl);
thumb.loadImage();
return convertView;
}
xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<GridView android:id="@+id/gridview" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:numColumns="auto_fit"
android:verticalSpacing="2dp" android:horizontalSpacing="2dp"
android:columnWidth="150dp"
android:rowHeight="150dp"
android:fadingEdge="vertical"
android:paddingLeft="2dp" android:paddingRight="2dp"
android:gravity="center" />
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="150dp"
android:layout_height="150dp">
<com.github.droidfu.widgets.WebImageView android:id="@+id/thumb"
android:scaleType="fitCenter" android:layout_weight="1"
android:layout_width="150dp"
android:layout_height="150dp" xmlns:android="http://schemas.android.com/apk/res/android" >
</com.github.droidfu.widgets.WebImageView>
</RelativeLayout>