例如,我一直在关注许多关于如何优化诸如画廊之类的列表的教程,但我无法让我的适配器重新循环视图。这是我的代码:
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Log.d("ImageAdapter","getView : "+convertView);
ImageView imageView = null;
if (convertView == null){
//imageView = (ImageView) mInflater.inflate(R.layout.pic_adapter, null);
imageView = new ImageView(context);
holder = new ViewHolder();
holder.imageView = imageView;
imageView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
//imageView = holder.imageView;
}
holder.imageView.setImageDrawable(plotsImages.get(position));
Log.d("ImageAdapter","return : "+imageView);
return imageView;
}
在我的日志中,我在 getView 的开头一直得到“null”,这意味着 convertView 不是一些重新循环的视图,那是怎么回事?
谢谢你的帮助!