Android Radio buttons in a custom listview changes its state when we scroll the list

前端 未结 3 535
刺人心
刺人心 2021-01-05 22:01

I am a beginner and facing a problem where I am creating a ListView with two RadioButtons and a TextView. Everything goes fine, but wh

3条回答
  •  萌比男神i
    2021-01-05 22:36

    You need to save the state of RadioButton for each item, so while scrolling in getView() method first it will check the state of each RadioButton.

    Step1:- You need to create a Pojo class(Setter & Getter) for saving the state of RadioButton.

    For more details go through the below link

    http://amitandroid.blogspot.in/2013/03/android-listview-with-checkbox-and.html

    This example is a ListView with CheckBox you need to change it to RadioButton according to your requirement.

提交回复
热议问题