0

I have used list view to display feedback option and used individual relative layout to display question and displayed options in radio group buttons. My Problem is If I select option A for question 1 then the same option automatically get selected for some other questions while scrolling. I need solution to overcome this problem. Awaiting for reply. Thanks in advance.

4

1 回答 1

0

这是由于 Android 中列表视图的视图回收。

由于您没有提供任何特定代码,我将尝试以 android-ish 风格进行演示

在您的适配器中,您应该在“内存中”保留一个包含用户选择答案的列表。

ArrayList<int> answers = new ArrayList<int>();

当用户选择一个选项时(onClick()?)将该选项保存在答案列表的适当位置

answers.add(position, selectedAnswer);

在您的适配器 getView(int position, View convertView, ViewGroup parent) 中,使用该位置正确填充您的答案视图,如下所示

convertView.findViewById(R.id.answer_view).setAnswer(answers.get(position));
于 2013-10-09T13:17:05.327 回答