라디오버튼 클릭시 각각 다른 텍스트뷰 출력

조회수 2051회

                <RadioButton
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="월세"
                    android:id="@+id/etMr"
                    android:layout_centerVertical="true"
                    android:layout_alignParentStart="true"
                    android:textSize="30dp"/>

                <RadioButton
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="전세"
                    android:id="@+id/etDps"
                    android:layout_centerVertical="true"
                    android:layout_toEndOf="@+id/radioButton"
                    android:textSize="30dp"/>
                <RadioButton
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="매매"
                    android:id="@+id/etSp"
                    android:layout_centerVertical="true"
                    android:layout_toEndOf="@+id/radioButton"
                    android:textSize="30dp"/>
            </RadioGroup>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:text="월세"
                android:textSize="30dp"/>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="보증금"
                android:textSize="20dp"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:weightSum="1">
                <EditText
                    android:layout_width="300dp"
                    android:layout_height="50dp"
                    android:hint="금액 입력"
                    android:id="@+id/etPrice"/>
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:text="만원"
                    android:textSize="30dp"
                    android:layout_alignParentRight="true"
                    android:layout_weight="1" />
            </LinearLayout>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="월세"
                android:textSize="20dp"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:weightSum="1">
                <EditText
                    android:layout_width="300dp"
                    android:layout_height="50dp"
                    android:hint="금액 입력"
                    android:id="@+id/etmonthly_rent"/>
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:text="만원"
                    android:textSize="30dp"
                    android:layout_alignParentRight="true"
                    android:layout_weight="1" />
            </LinearLayout>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:text="전세"
                android:textSize="30dp"/>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="전세금"
                android:textSize="20dp"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:weightSum="1">
                <EditText
                    android:layout_width="300dp"
                    android:layout_height="50dp"
                    android:hint="금액 입력"
                    android:id="@+id/etDeposit"/>
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:text="만원"
                    android:textSize="30dp"
                    android:layout_alignParentRight="true"
                    android:layout_weight="1" />
            </LinearLayout>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:text="매매"
                android:textSize="30dp"/>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="매매금"
                android:textSize="20dp"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:weightSum="1">
                <EditText
                    android:layout_width="300dp"
                    android:layout_height="50dp"
                    android:hint="금액 입력"
                    android:id="@+id/etSaleprice"/>
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:text="만원"
                    android:textSize="30dp"
                    android:layout_alignParentRight="true"
                    android:layout_weight="1" />
            </LinearLayout>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="입주금"
                android:textSize="20dp"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:weightSum="1">
                <EditText
                    android:layout_width="300dp"
                    android:layout_height="50dp"
                    android:hint="금액 입력"
                    android:id="@+id/etIpjugeum"/>
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:text="만원"
                    android:textSize="30dp"
                    android:layout_alignParentRight="true"
                    android:layout_weight="1" />
            </LinearLayout>

위에 코드에 라디오 버튼3개가 있는데요. 라디오버튼을 각각 클릭시 다른 텍스트뷰랑 에디트뷰를 출력하고 싶습니다. 월세라는 라디오버튼을 클릭하면

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="보증금"
                android:textSize="20dp"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:weightSum="1">
                <EditText
                    android:layout_width="300dp"
                    android:layout_height="50dp"
                    android:hint="금액 입력"
                    android:id="@+id/etPrice"/>
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:text="만원"
                    android:textSize="30dp"
                    android:layout_alignParentRight="true"
                    android:layout_weight="1" />
            </LinearLayout>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="월세"
                android:textSize="20dp"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:weightSum="1">
                <EditText
                    android:layout_width="300dp"
                    android:layout_height="50dp"
                    android:hint="금액 입력"
                    android:id="@+id/etmonthly_rent"/>
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:text="만원"
                    android:textSize="30dp"
                    android:layout_alignParentRight="true"
                    android:layout_weight="1" />
            </LinearLayout>

이부분들만 화면에 보이고 전세를 클릭하면 전세부분만 보이게 하고 싶습니다.

처음에는 안보이다가 라디오버튼을 클릭했을대 각기 다른텍스트를 보이게 하려면 어떻게 해야하나요?

  • (•́ ✖ •̀)
    알 수 없는 사용자

1 답변

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)