要的效果就是类似京东淘宝选择收货地址信息代码一样。
选中后会在信息后面出 编辑 现删除 按钮。我这种创建出现的按钮样式非常难看 并且要么不并排列,要么都并排。刚接触不久,麻烦各位了!先在此谢谢大家!
for (final Contact info : responseList) { radioButton = new RadioButton(this);
radioButton.setId(Integer.parseInt(info.id));
radioButton.setText(info.name + getString(R.string.blank_space) + info.address + info.address_detail + getString(R.string.blank_space));
mRadioGroup.addView(radioButton); delbtn = new Button(this);
delbtn.setText(R.string.delete);
mRadioGroup.addView(delbtn);
}AndroidRadioButton
选中后会在信息后面出 编辑 现删除 按钮。我这种创建出现的按钮样式非常难看 并且要么不并排列,要么都并排。刚接触不久,麻烦各位了!先在此谢谢大家!
for (final Contact info : responseList) { radioButton = new RadioButton(this);
radioButton.setId(Integer.parseInt(info.id));
radioButton.setText(info.name + getString(R.string.blank_space) + info.address + info.address_detail + getString(R.string.blank_space));
mRadioGroup.addView(radioButton); delbtn = new Button(this);
delbtn.setText(R.string.delete);
mRadioGroup.addView(delbtn);
}AndroidRadioButton
还有,addView有另一个方法,带LayoutPrameter的,可以设置控件布局参数的
// 设置布局对象lla的属性
layout.setOrientation(LinearLayout.HORIZONTAL); //
layout.setLayoutParams(new LinearLayout.LayoutParams(800, 40));
// 然后在创建控件
radioButton = new RadioButton(this);
radioButton.setId(Integer.parseInt(info.id));
radioButton.setText(info.name + getString(R.string.blank_space) + info.address + info.address_detail + getString(R.string.blank_space));
// mRadioGroup.addView(radioButton);
// 把控件放到布局里头 layout.addView(radioButton); delbtn = new Button(this);
delbtn.setText(R.string.delete);
delbtn.setWidth(80);
// mRadioGroup.addView(delbtn);
layout.addView(delbtn);
mRadioGroup.addView(layout);
这样的话单选就不好使了。