// 支出类型
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 发布
本文详细介绍了如何在Android应用中实现一个自定义的支出分类控件,包括使用RadioButton和设置drawable属性来创建一个简单且实用的通用分类选项。
968

被折叠的 条评论
为什么被折叠?



