Change Switch state without animation

前端 未结 7 1909
醉酒成梦
醉酒成梦 2020-12-09 07:54

In my Android project, I have a ListView with rows containing SwitchCompat items (AppCompat for Switch widget).

My problem occ

相关标签:
7条回答
  • 2020-12-09 08:31

    I finally found a solution but seems not really clean:

    ViewGroup viewGroup = (ViewGroup) view; // the recycled view
    viewGroup.removeView(switch);
    switch.setChecked(states[index]);
    viewGroup.addView(switch);
    

    If a better solution exists, please share it.

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