본문 바로가기

Android

Android] Radio Button

RadioButton - 여러 종류의 선택 항목에서 한가지 선택

 

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
       <RadioButton
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:text="1번"
           />

       <RadioButton
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:text="2번"
           />

       <RadioButton
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:text="3번"
           />
</LinearLayout>

라디오 버튼의 3가지를 단독으로 만들 었을 때 버튼 3개를 모두 중복으로 선택 가능

 

<RadioGroup
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
       <RadioButton
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:text="1번"
           />

       <RadioButton
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:text="2번"
           />

       <RadioButton
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:text="3번"
           />
</RadioGroup>

중복이 불가능 하게 한 가지의 버튼만 선택할 경우 RadioGroup 안에 RadioButton 작성

 



Calendar
«   2025/08   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
Tags
더보기
Archives
Visits
Today
Yesterday