GridView を使用して画像を表示し、この画像を非同期的にロードしています。すべてが適切に機能していますが、問題は、画像が上から下ではなく、下から上に GridView に読み込まれることだけです。この問題を解決する方法を本当に理解できません。この問題について私を助けてください。
EDIT1: GridView アダプター コード:
public class ImageThumbAdapter extends BaseAdapter {
private Activity context;
private ArrayList<HashMap<String, String>> mImageList;
private ImageLoader mImageLoader;
private int mItemHeight = 0;
private int mNumColumns = 0;
private GridView.LayoutParams mImageViewLayoutParams;
public ImageThumbAdapter(Activity c,
ArrayList<HashMap<String, String>> imageList) {
context = c;
mImageList = imageList;
mImageLoader = new ImageLoader(context);
mImageViewLayoutParams = new GridView.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
}
public int getCount() {
return mImageList.size();
}
public Object getItem(int position) {
return mImageList.get(position);
}
public long getItemId(int position) {
return position;
}
public void addImage(HashMap<String, String> image) {
mImageList.add(image);
}
public View getView(int position, View convertView, ViewGroup parent) {
// Now handle the main ImageView thumbnails
ImageView imageView;
if (convertView == null) { // if it's not recycled, instantiate and
// initialize
imageView = new ImageView(context);
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setLayoutParams(mImageViewLayoutParams);
}
else { // Otherwise re-use the converted view
imageView = (ImageView) convertView;
}
if (imageView.getLayoutParams().height != mItemHeight) {
imageView.setLayoutParams(mImageViewLayoutParams);
}
String imageName = String.format(
"gallery_",
mImageList.get(position).get(TAG_THUMB_URL));
imageView.setTag(imageName);
mImageLoader.setDefualtStub(R.drawable.ic_thumbnail);
mImageLoader.DisplayImage(
mImageList.get(position).get(TAG_THUMB_URL), context,
imageView, imageName, new ImageLoadingListener());
return imageView;
}
....
}
Edit2:位置のログ
08-10 23:16:23.132: I/System.out(785): Position: 0
08-10 23:16:23.142: I/System.out(785): Position: 0
08-10 23:16:23.142: I/System.out(785): Position: 1
08-10 23:16:23.152: I/System.out(785): Position: 2
08-10 23:16:23.152: I/System.out(785): Position: 3
08-10 23:16:23.152: I/System.out(785): Position: 4
08-10 23:16:23.162: I/System.out(785): Position: 5
08-10 23:16:23.162: I/System.out(785): Position: 6
08-10 23:16:23.162: I/System.out(785): Position: 7
08-10 23:16:23.172: I/System.out(785): Position: 8
08-10 23:16:23.172: I/System.out(785): Position: 9
08-10 23:16:23.172: I/System.out(785): Position: 10
08-10 23:16:23.182: I/System.out(785): Position: 11
08-10 23:16:23.182: I/System.out(785): Position: 12
08-10 23:16:23.192: I/System.out(785): Position: 13
08-10 23:16:23.192: I/System.out(785): Position: 14
08-10 23:16:23.192: I/System.out(785): Position: 15
08-10 23:16:23.312: D/dalvikvm(785): GC_EXPLICIT freed 434K, 20% free 9440K/11655K, paused 5ms+5ms
08-10 23:16:23.322: D/ImageLoader(785): gallery_http:%0%0s3.amazonaws.com%0DEV_ALC_USRDATA%013222763351652338265%0cms_Gallery%02x_1342687302114.143.121.36Apple-icon.gif.jpg Image doesn't exits in cache
08-10 23:16:23.322: D/ImageLoader(785): gallery_http:%0%0s3.amazonaws.com%0DEV_ALC_USRDATA%013222763351652338265%0cms_Gallery%02x_1342687302114.143.121.36Apple-icon.gif.jpg Downloading from server
08-10 23:16:23.902: D/dalvikvm(785): GC_EXPLICIT freed 98K, 19% free 9502K/11655K, paused 5ms+5ms
08-10 23:16:23.902: I/System.out(785): Position: 0
08-10 23:16:23.912: I/System.out(785): Position: 0
08-10 23:16:23.932: D/ImageLoader(785): igallery_http:%0%0s3.amazonaws.com%0DEV_ALC_USRDATA%013222763351652338265%0cms_Gallery%02x_1342687299114.143.121.3627.png.jpg Image doesn't exits in cache
08-10 23:16:23.952: D/ImageLoader(785): igallery_http:%0%0s3.amazonaws.com%0DEV_ALC_USRDATA%013222763351652338265%0cms_Gallery%02x_1342687299114.143.121.3627.png.jpg Downloading from server
08-10 23:16:25.202: D/dalvikvm(785): GC_EXPLICIT freed 110K, 18% free 9614K/11655K, paused 4ms+6ms
08-10 23:16:25.212: I/System.out(785): Position: 0
08-10 23:16:25.222: I/System.out(785): Position: 0
08-10 23:16:25.242: D/ImageLoader(785): igallery_http:%0%0s3.amazonaws.com%0DEV_ALC_USRDATA%013222763351652338265%0cms_Gallery%02x_1342572563101.98.165.177bleyendall.png.jpg Image doesn't exits in cache
08-10 23:16:25.262: D/ImageLoader(785): igallery_http:%0%0s3.amazonaws.com%0DEV_ALC_USRDATA%013222763351652338265%0cms_Gallery%02x_1342572563101.98.165.177bleyendall.png.jpg Downloading from server
08-10 23:16:26.122: D/dalvikvm(785): GC_EXPLICIT freed 89K, 17% free 9691K/11655K, paused 4ms+5ms
08-10 23:16:26.122: I/System.out(785): Position: 0
08-10 23:16:26.132: I/System.out(785): Position: 0
...
ありがとう、