listView items disappears on scroll for android 2.3 -
on load of fragment. after scrolling smoothly data appears. again disappera
android list view on scroll content gets invisible 2.3. working fine 4.0 , above. problem when scroll listview data gets disappear , images shown only. if scroll smoothly , tap 1 or 2 sec. on list data shown on scroll data gets disappear.
below adapter code -
public class restaurantlistadapter extends baseadapter { private arraylist<restaurantlist> restaurantlist; private layoutinflater inflater; private imageloader imageloader; private context context; private viewholder viewholder = null; displayimageoptions options; public restaurantlistadapter(activity activity, arraylist<restaurantlist> restaurantlist) { this.context = activity; this.restaurantlist = restaurantlist; this.inflater = layoutinflater.from(this.context); imageloader = imageloader.getinstance(); options = new displayimageoptions.builder().cacheinmemory(true) .cacheondisc(true).bitmapconfig(bitmap.config.rgb_565).build(); } public int getcount() { return restaurantlist.size(); } public object getitem(int position) { return position; } public long getitemid(int position) { return position; } public view getview(int position, view convertview, viewgroup parent) { if (convertview == null) { viewholder = new viewholder(); convertview = inflater.inflate( r.layout.restaurant_list_item_layout, null); viewholder.restaurantnametextview = (textview) convertview .findviewbyid(r.id.restaurantnametextview); viewholder.restaurantaddresstextview = (textview) convertview .findviewbyid(r.id.restaurantaddresstextview); viewholder.restaurantpintextview = (textview) convertview .findviewbyid(r.id.restaurantpintextview); viewholder.restaurantphonetextview = (textview) convertview .findviewbyid(r.id.restaurantphonetextview); viewholder.favoriteimagebutton = (imagebutton) convertview .findviewbyid(r.id.favoriteimagebutton); convertview.settag(viewholder); } else { viewholder = (viewholder) convertview.gettag(); } restaurantlist restaurant = restaurantlist.get(position); viewholder.restaurantnametextview.settext(restaurant .getrestaurantname()); viewholder.restaurantaddresstextview.settext(restaurant .getrestaurantaddress()); viewholder.restaurantpintextview.settext(restaurant.getrestaurantpin()); viewholder.restaurantphonetextview.settext(restaurant .getrestaurantphone()); viewholder.favoriteimagebutton.setfocusable(false); viewholder.restaurantnametextview.setvisibility(view.visible); return convertview; } static class viewholder { textview restaurantnametextview; textview restaurantaddresstextview; textview restaurantpintextview; textview restaurantphonetextview; imagebutton favoriteimagebutton; imageview restaurentimageview; } }
simply add
android:cachecolorhint="@android:color/transparent"
listview in xml layout
Comments
Post a Comment