RadioGroup是Android中比较常用到的一个ViewGroup。所以,本文对于RadioGroup本身就不做过多介绍了,仅仅介绍一下如何在Java代码中动态设置属性以及动态添加RadioButton。
动态配置weight属性
RadioGroup作为LinearLayout的直接子类,当然可以设置weight
属性,我们可以在代码中调用下面的方法来设置:
/**
* Defines the desired weights sum. If unspecified the weights sum is computed
* at layout time by adding the layout_weight of each child.
*
* This can be used for instance to give a single child 50% of the