super.onCreate(icicle); setContentView(R.layout.main); LinearLayout ll = (LinearLayout)findViewById(R.id.ll); RadioGroup rg = new RadioGroup(this); rg.setLayoutParams(new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)); ll.addView(rg); RadioGroup.LayoutParams rlp = new RadioGroup.LayoutParams( RadioGroup.LayoutParams.WRAP_CONTENT, RadioGroup.LayoutParams.WRAP_CONTENT); RadioButton foo = new RadioButton(this); foo.setText("foo"); foo.setLayoutParams(rlp); rg.addView(foo); RadioButton bar = new RadioButton(this); bar.setText("bar"); bar.setLayoutParams(rlp); rg.addView(bar); RadioButton baz = new RadioButton(this); baz.setText("baz"); baz.setLayoutParams(rlp); rg.addView(baz);