我有一个TextView的列表视图,每行中的按钮。按钮背景使用一些条件设定。如果我在列表中滚动的行数,按钮背景获得洗牌。这意味着在滚动错背景设置为按钮的背景。我该如何解决这个问题?我的适配器类,如下所示:
I have a listview with one textview and a button in each row. Button background is setting using some conditions. If i have number of rows in list and scrolled, the button background get shuffling. That means on scrolling wrong background is setting as button background. How can i resolve this issue? My adapter class is as shown below:
public View getView(int position, View convertView, ViewGroup parent) {
final PhotoCondtionthreeItemView item;
Photo place = (Photo) getItem(position);
if (convertView != null) {
item = (PhotoCondtionthreeItemView) convertView;
} else {
item = new PhotoCondtionthreeItemView(context, place,
membershipSign);
}
item.setShareTag(place.getLink()+"@@@"+place.getServerPhotoId());
item.setBaseLayoutTag(place.getLink() + "@@@"
+ place.getServerPhotoId() + "@@@" + place.getIsGallery()
+ "@@@" + place.getId());
File file;
try {
file = new File(place.getLink());
if (file.exists()) {
if (cache.containsKey(place.getLink())) {
item.setThumbImg(cache.get(place.getLink()));
} else {
Bitmap bitmap = BitmapResizer.decodeFile(file, 50, 50);
item.setThumbImg(bitmap);
cache.put(place.getLink(), bitmap);
}
} else {
item.setThumbImgMissing();
}
} catch (Exception e) {
Log.e("PhotoCondThree ERROR", e.toString());
}
return item;
}
在PhotoCondtionthreeItemView类创建的行列表。 (未使用XML为列表行)。
In PhotoCondtionthreeItemView class created the row for list. (not used xml for list row).
谁能帮助我?
感谢您
呼叫 yourListViewadapter.notifyDataSetChanged()
当数据被更改