Skip to content Skip to sidebar Skip to footer

Images In Gridview Change Their Position On Scrolling In Android

I am trying to fill my Gridview with some TextViews and Imageviews. I did it successfully, but when I scroll down in the grid, the images change their postion. I have read some oth

Solution 1:

You need to call findViewById when convertView == null.

if (convertView == null) {
    convertView = l_Inflater.inflate(R.layout.activity_gridview_items, parent, false);
    holder = new ViewHolder();

    holder.txt_itemName = (TextView) convertView
        .findViewById(R.id.tv_item_title);
    holder.txt_itemDescription = (TextView) convertView
        .findViewById(R.id.tv_item_detail);
    holder.txt_itemPrice = (TextView) convertView
        .findViewById(R.id.tv_item_price);
    holder.itemImage = (ImageView) convertView
        .findViewById(R.id.iv_item_image);

    convertView.setTag(holder);
} else {
    holder = (ViewHolder) convertView.getTag();
}       

Post a Comment for "Images In Gridview Change Their Position On Scrolling In Android"