Dynamic change on listview row layout affects other rows too

后端 未结 2 1619
隐瞒了意图╮
隐瞒了意图╮ 2021-01-07 03:06

I am using ListView and there are several buttons on each list element.

when a button on a row is clicked that button should disappear. the clicked button disappears

相关标签:
2条回答
  • 2021-01-07 03:10

    You should keep track of each element buttons state weather shown or hidden. in getView() method of the adapter check for the current element state then hide or show button accordingly. when using this method make sure to set each button state not only the one that should be hidden so when the view recycle, the view gets the new item state not the old one.

    0 讨论(0)
  • 2021-01-07 03:30

    Amal has part of your answer. When your adapter gets a getview call completely reinitialize the reused view.

    As for your speed problem. Sounds like you want your adapter to load its data lazily. Your loading of that data is slow. Something has to give. A common solution to this problem is to load your data in a background thread.

    0 讨论(0)
提交回复
热议问题