잘안쓰지만 언젠가는 사용할일이 있겠지 싶은 물건.
주의할점이라고 하면 RadioGroup , RadioButton은 직계 부모 자식 간이어야 합니다.
먼저 그룹값을 가져온뒤
그중에 선택퇸 라디오버튼을 다시한번 가져와서
그것의 라벨내용을 사용합니다.
출처 - http://marocchino.blogspot.kr/2009/10/%EC%95%88%EB%93%9C%EB%A1%9C%EC%9D%B4%EB%93%9C-%EB%9D%BC%EB%94%94%EC%98%A4%EB%B2%84%ED%8A%BC%EB%9D%BC%EB%94%94%EC%98%A4%EA%B7%B8%EB%A3%B9-android.html
<RadioGroup android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/sex" android:orientation="horizontal"> <RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/male" android:text="@string/male"></RadioButton> <RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/female" android:text="@string/female"></RadioButton> </RadioGroup>
RadioGroup sexGroup = (RadioGroup) findViewById(R.id.sex);
RadioButton sex = (RadioButton) findViewById(sexGroup.getCheckedRadioButtonId());
sex.getText().toString();
댓글
댓글 쓰기