android - Lazylist hides other images while scrolling if not all images are included -
i used example make lazylist: lazy load of images in listview
but in list not rows have images. updated code inside adapter hide imageview if there no image:
public view getview(int position, view convertview, viewgroup parent) { view vi=convertview; if(convertview==null) vi = inflater.inflate(r.layout.item, null); textview text=(textview)vi.findviewbyid(r.id.text);; imageview image=(imageview)vi.findviewbyid(r.id.image); text.settext("item "+position); if(data[position].contains(".jpg") || data[position].contains(".png")) { imageloader.displayimage(data[position], image); }else image.setvisibility(image.gone); return vi; }
to test omitted 1 image follows:
private string[] mstrings={ "http://a3.twimg.com/profile_images/670625317/aam-logo-v3-twitter.png", "", "http://a3.twimg.com/profile_images/121630227/droid_normal.jpg", .....
however, after running app, noticed list began hide other images while scrolling strange behavior. can simulate problem making above 2 changes code , test list.
you not resetting state.
if(data[position].contains(".jpg") || data[position].contains(".png")) { image.setvisibility(view.visible); imageloader.displayimage(data[position], image); }else{ image.setvisibility(view.gone); }
also advise loading state image set default drawable or progressbar shown instead of image.
Comments
Post a Comment