由于原生的Radiobutton不能满足业务需求,所以需要自己定制icon图片,和默认选中某一项。需要自己代码动态实现。废话不多说,上代码:
private void setViewData() {
radioGroup.removeAllViews();
int margin = ScreenUtil.dip2px(this, 14.0f);
int marginLeft = ScreenUtil.dip2px(this, 20.0f);
int paddingLeft = ScreenUtil.dip2px(this, 3.0f);
RadioGroup.LayoutParams layoutParams =
new RadioGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
RadioGroup.LayoutParams layoutParams1 =
new RadioGroup.LayoutParams(ViewGroup