您的位置:首页 > 移动开发 > Android开发

Android RadioButton class three kinds of checked way

2011-12-14 20:02 381 查看
The first : main.xml file,RadioButton element add android:checked attribute,
set "true";

The second : use setChecked() on the RadioButton from within your onCreate() callback in your activity.example:

RadioButton rb = (RadioButton)findViewById(R.id.radio1);

rb.setChecked(true);

The third:use check() on the RadioGroup from within your onCreate() callback in your activity.example:

RadioGroup rg = (RadioGroup)findViewById(R.id.radiogroup);

rg.check(R.id.radio2);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: