-1

我已经成功地设置了从可绘制目录(本地)加载图像,我正在考虑更改它,以便它将从网络加载图像。

我在 GridView 中显示图像,我必须对我的代码做什么才能从 Web 加载它们?

任何帮助将不胜感激,谢谢。

适配器:

package com.question;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;

public class AdapterViewADV extends BaseAdapter {
private Context mContext;


public Integer[] mThumbIds = {
    R.drawable.Image1,
    R.drawable.Image2,
    R.drawable.Image3,
    R.drawable.Image4,
    R.drawable.Image5,
    R.drawable.Image6

};


public AdapterViewADV(Context c){
mContext = c;
}

@Override
public int getCount() {
    return mThumbIds.length;
}

@Override
public Object getItem(int position) {
return mThumbIds[position];
}

@Override
public long getItemId(int position) {
return 0;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
ImageView imageView = new ImageView(mContext);
imageView.setImageResource(mThumbIds[position]);
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setLayoutParams(new GridView.LayoutParams(NO_SELECTION, NO_SELECTION));
return imageView;
}

} 
4