如何显示一个单选按钮和内部ListView的一个EditText? [英] How to show a RadioButton and an EditText inside ListView?
问题描述
我要实现单选和EditText上一个ListView的行内。我使用的是ArrayAdapter来填充列表。但问题是,当我选择一个单选按钮和向下滚动列表并滚动再次被选中该单选框的选中。相同的的EditText的内容。文本得到清除时,我向上滚动。
I want to implement RadioButton and EditText inside a row of a ListView. I am using an ArrayAdapter to populate the List. But the problem is that when i am selecting a RadioButton and scroll down the list and scroll up again the Radiobutton which had been selected is unselected. Same with the content of the EditText. The text getting removed when I scroll up.
推荐答案
检查您的适配器,你可能没有做正确的工作bindView()
。你必须重新设置 bindView()
的值。
Check your adapter, you are probably don't do the job right on bindView()
. You have to set again on bindView()
the values.
我将改写这句话,你可能会就明白了。
在 NewView的()
创建只有5-10次(尽可能多的他们适合在屏幕上),它们是为其他行重复使用。如果你有一个的ListView
200行吧,其实你只有5-10的看法,你必须确保你更新的有效变化的意见, bindView()
。你必须保存/更改保存到以后重复使用的对象。
I will reformulate the sentence and you will probably will understand.
The newView()
creates only 5-10 views (as many they fit on the screen), and they are reused for other rows. If you have a ListView
with 200 lines in it, actually you have only 5-10 views, and you have to make sure you update the views with the valid changes in bindView()
. You have to store/save the changes to an object for later reuse.
这篇关于如何显示一个单选按钮和内部ListView的一个EditText?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!