当我开始滚动我的视图时。它重复图像,但当我点击它打开正确的图像。我尝试了很多解决方案,但我仍然无法修复它。我在converView中尝试了很多东西。但它不断重复图像并将其置于视野中。
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ImageView imageView;
View v;
if (convertView == null) {
/* LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
v = inflater.inflate(R.layout.gridview_item_layout, parent, false);
*/
imageView = new ImageView(context);
if(images.get(position).contains(".jpg"))
{
bm = BitmapFactory.decodeFile(images.get(position)); //Creation of Thumbnail of image
}
else if(images.get(position).contains(".mp4"))
{
bm = ThumbnailUtils.createVideoThumbnail(images.get(position), 0); //Creation of Thumbnail of video
}
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setPadding(8,8,8,8);
imageView.setLayoutParams(new GridView.LayoutParams(300, 300));
} else {
imageView = (ImageView) convertView;
}
imageView.setImageBitmap(bm);
return imageView;
}
}