Dynamic change on listview row layout affects other rows too

后端 未结 2 1630
隐瞒了意图╮
隐瞒了意图╮ 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.

提交回复
热议问题