RadioGroup rg = new RadioGroup(zhangjieActivity.this);
final RadioButton aItem = new RadioButton(zhangjieActivity.this);
aItem.setButtonDrawable(R.drawable.myradio);
aItem.setPadding( 40, 0, 0, 0);
aItem.setText("11111");
aItem.setTextColor(this.getResources().getColor(
R.color.processTextColor));
aItem.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.e("",""+v.getId());
}
});
RadioGroup.LayoutParams margin = new RadioGroup.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
margin.topMargin = 2;
margin.leftMargin = 100;
rg.addView(aItem,margin);