Android ListView not redraw properly -
i have listfragment
custom row. problem when scroll items, underlying items don't disappear. remains visible , didnt't find solution problem.
loader loads items database through arrayadapter
@override public view getview(int position, view row, viewgroup parent) { viewholder holder = null; if(row == null) { row = minflater.inflate(r.layout.list_item_expense, null, false); holder = new viewholder(); holder.layout = (checkablelinearlayout)row.findviewbyid(r.id.mylinearlayout); holder.id = ((textview)row.findviewbyid(r.id.id)); holder.category = ((textview)row.findviewbyid(r.id.category)); holder.date = ((textview)row.findviewbyid(r.id.date)); holder.note = ((textview)row.findviewbyid(r.id.note)); row.settag(holder); // watch checked state , remember holder.layout.setcheckchangelistener(expenselistadapter.this); } else { holder = (viewholder)row.gettag(); } expense item = getitem(position); holder.id.settext(integer.tostring(item.getid())); holder.category.settext(integer.tostring(item.getcategory())); holder.note.settext(item.getnote()); holder.date.settext(item.getdatedisplay()); holder.layout.settag(r.id.mylinearlayout, position); // restore checked state final listview lv = (listview)parent; holder.layout.setchecked(lv.isitemchecked(position)); return row; }
row layout is:
<?xml version="1.0" encoding="utf-8"?> <com.nutelar.expensemaster.checkablelinearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mylinearlayout" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <textview android:id="@+id/id" android:layout_width="48dip" android:layout_height="wrap_content" android:clickable="false" android:focusable="false" android:textcolor="@color/textcolor" android:textisselectable="false" /> <textview android:id="@+id/category" android:layout_width="48dip" android:layout_height="wrap_content" android:clickable="false" android:focusable="false" android:textcolor="@color/headercolor" android:textisselectable="false" /> <textview android:id="@+id/date" android:layout_width="248dip" android:layout_height="wrap_content" android:clickable="false" android:focusable="false" android:textisselectable="false" /> <textview android:id="@+id/note" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_weight="1.0" android:clickable="false" android:focusable="false" android:textisselectable="false" /> <com.nutelar.expensemaster.inertcheckbox android:id="@+id/itemcheckbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentright="true" android:layout_centervertical="true" android:layout_marginright="5dp" android:focusable="false" /> </com.nutelar.expensemaster.checkablelinearlayout>
when scroll up, previous rows remains "underlying" while new data loads in "foreground". rows looks shifted down.
Comments
Post a Comment