如何在 ListView 中显示 RadioButton???

2019-03-25 13:50|来源: 网路

因为看到可以在 ListView 中显示 ImageView, TextView, Checkbox 等等...

所以想如何实现在 ListView 中显示 RadioButton???

可现在的问题是:
1. 我实现了在 ListView 中显示 RadioButton 控件. 但是所有的 RadioButton 控件都可以被选中,  但是我只想其中之一的一个能被选中...如何现实???



2. 在 ListView 下面的控件不能显示. 也就是说, 如果我的 item 很多, 如何实现 item 后面的控件也能被显示??

相关问答

更多
  • 试试这个:来自CodeBehind MyRadioButtonList.Items[0].Attributes.CssStyle.Add("visibility", "hidden"); 编辑: int count = 0; //index of item tobe hidden foreach (ListViewDataItem item in ListView1.Items) { var rbl = (RadioButtonList)item.FindControl("rblSelect" ...
  • 您已经在List和ArrayAdapter中定义了RadioButton数据类型,并且您正在传递RadioButton的对象,因此它将打印RadioButton对象。 如果你想传递RadioButton的文本然后使用下面的代码。 public class SpecialListActivity extends Activity { private ListView listView; private ArrayAdapter adapter; @Override public void ...
  • 您必须将两个单选按钮绑定到同一个变量。 此外,变量将接收value关键字参数中指定的value 。 我建议你做以下事情: option = StringVar() R1 = Radiobutton(root, text="MALE", value="male", var=option) R2 = Radiobutton(root, text="FEMALE", value="female", var=option) 您可以通过跟踪option变量并调用其get方法来了解当前选择的项目。 例如,每当检查相应 ...
  • 我认为你应该使用共享偏好。 保存radiobutton的状态 我想这就是你要找的东西。 I did go back and implement Shared Preferences into my project as Mridul suggested, but the solution really didn't require them. Basically, I updated the constructor of my ServerActivityArrayAdapter class to let ...
  • 此行为来自这样的事实:在这种情况下, ListViewItem的IsKeyboardFocusWithin -Property为false。 当您单击RadioButton时,RadioButton具有Keyboard-Focus。 解 像这样添加一个简单的触发器