问题描述
我正在尝试向视图添加单选按钮(android),但出现错误
我的代码-
public void CreateRadio(HVArrangement layout,String text) {
createRadioButton(layout.getView(),text);
}
private void createRadioButton(View view1,String text) {
LinearLayout top = (LinearLayout) view1;
final RadioButton[] rb = new RadioButton[1];
RadioGroup rg = new RadioGroup(container.$context()); //create the RadioGroup
rg.setOrientation(RadioGroup.HORIZONTAL);//or RadioGroup.VERTICAL
rb[1] = new RadioButton(container.$context());
rb[1].setText(text);
rb[1].setId(1);
rg.addView(rb[1]);
top.addView(rg);//you add the whole RadioGroup to the layout
}
但是我收到android.widget.FrameLayout cannot be cast to android.widget.LinearLayout
请帮助我
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)