【发布时间】:2012-06-12 16:33:53
【问题描述】:
我在 xml 中有一个单选组,并且按钮是通过编程方式生成的。如何以编程方式在按钮之间添加间距。
我认为它类似于LayoutParams,但我的对象没有明显的setPadding 或setMargins 方法。
这就是我正在尝试的
RadioButton currentButton = new RadioButton(context);
currentButton.setText(item.getLabel());
currentButton.setTextColor(Color.BLACK);
//add padding between buttons
LayoutParams params = new LayoutParams(context, null);
params. ... ??????
currentButton.setLayoutParams(params);
【问题讨论】:
标签: android radio-button padding margin radio-group