// 支出类型
rgCategorys = (RadioGroup) findViewById(R.id.rg_categorys);
RadioButton rbGeneral = new RadioButton(getApplicationContext());
Drawable drawable = this.getResources().getDrawable(R.drawable.selector_project_general);
rbGeneral.setText("通用");
rbGeneral.setTextColor(R.color.black_text);
rbGeneral.setTextSize(12);
rbGeneral.setCompoundDrawablesRelativeWithIntrinsicBounds(null, drawable, null, null); //设置drawableTop
rbGeneral.setButtonDrawable(android.R.color.transparent); // 去掉默认圆圈按钮
rbGeneral.setGravity(Gravity.CENTER);
rbGeneral.setPadding(0, 5, 25, 0);
rgCategorys.addView(rbGeneral);
代码设置RadioButton
最新推荐文章于 2024-06-22 18:57:26 发布