【发布时间】:2021-04-09 17:38:12
【问题描述】:
我正在尝试修复 RadioButton 布局:
我帮助radioButton修复成这样:
这是我的代码:
ScrollView sv = new ScrollView(this);
ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.VERTICAL);
sv.addView(ll);
RadioButton[] rb = new RadioButton[10];
RadioGroup rg = new RadioGroup(this);
rg.setOrientation(RadioGroup.HORIZONTAL);
for(int j=0; j<((JSONArray) value).length(); j++){
rb[j] = new RadioButton(this);
rb[j].setText("" + ((JSONArray) value).getString(j));
rb[j].setId(i + 100);
rg.addView(rb[j]);
}
ll.addView(rg);
this.setContentView(sv);
【问题讨论】:
-
你应该自定义你的单选按钮 - stackoverflow.com/questions/19163628/…
标签: android radio-button