EditText in listview repeats the value

后端 未结 3 762
死守一世寂寞
死守一世寂寞 2020-12-22 04:57

I have three textviews and one edit text in the list. when I entered any value in the edittext, the same value is also copied in the other edittext. I tired implementing wit

3条回答
  •  無奈伤痛
    2020-12-22 05:57

    As we know ListView reuses the view of ListItem as we scroll the whole list.

    So problem arises when we have a custom ListView with EditText where if we enter any value in the first EditText and start scrolling then the value of EditText one is copied to another the EditTexts one by one as we scroll the listview .

    This happens as the listview reuses the view and as the other listitem from another view i.e. the view which is not seen scrolls upwards it reuses the old lists view and hence the old value of that view is seen in the new edittext.

    http://www.webplusandroid.com/creating-listview-with-edittext-and-textwatcher-in-android/

提交回复
热议问题