마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

스피너에 따라서 레이아웃을 다르게 보이게 하는 방법

0 추천

한 화면에서 스피너가 가장 상단에 존재하고, 그 스피너에 담긴 값에 따라

아래에 있는 탭뷰의 내용이 바뀌는 화면을 구성하고 싶습니다.

xml 코드는 이렇게 할 예정인데.. 자바 파일로 어떻게 저 부분을 구성할지 감이 안옵니다..

도와주세요!

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.cassykim.cassynotice.NoticeActivity">

    <Spinner
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:paddingTop="10dp"
        android:id="@+id/notice_spinner">

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/frame_layout">

            <TabHost
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/tabHost"
                android:paddingTop="10dp"
                android:orientation = "vertical">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight = "1"
                    android:orientation="vertical">

                    <TabWidget
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:id="@android:id/tabs">
                    </TabWidget>

                    <ScrollView
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_weight="1">

                        <FrameLayout
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:id="@android:id/tabcontent"
                            android:layout_weight = "1">

                            <LinearLayout
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:orientation="vertical"
                                android:id="@+id/myClassNotice">

                                <ListView
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:id="@+id/listView1">
                                </ListView>
                            </LinearLayout>

                            <LinearLayout
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:orientation="vertical"
                                android:id="@+id/reference">

                                <ListView
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:id="@+id/listView2">
                                </ListView>
                            </LinearLayout>

                            <LinearLayout
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:orientation="vertical"
                                android:id="@+id/homework">

                                <ListView
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:id="@+id/listView3">
                                </ListView>
                            </LinearLayout>

                            <LinearLayout
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:orientation="vertical"
                                android:id="@+id/questionAndAnswer">

                                <ListView
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:id="@+id/listView4">
                                </ListView>
                            </LinearLayout>
                        </FrameLayout>
                    </ScrollView>

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="70dp"
                        android:layout_alignParentRight = "true"
                        android:layout_gravity="bottom"
                        android:orientation="horizontal">

                        <Button
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:id="@+id/notice_main_button"
                            android:text="main"
                            android:onClick="onClick"
                            android:layout_marginLeft="10dp"
                            android:layout_gravity="center"/>
                    </LinearLayout>
                </LinearLayout>
            </TabHost>
        </FrameLayout>
    </Spinner>


</RelativeLayout>

 

기꺼2 (140 포인트) 님이 2016년 7월 29일 질문

답변 달기

· 글에 소스 코드 보기 좋게 넣는 법
· 질문에 대해 추가적인 질문이나 의견이 있으면 답변이 아니라 댓글로 달아주시기 바랍니다.
표시할 이름 (옵션):
개인정보: 당신의 이메일은 이 알림을 보내는데만 사용됩니다.
스팸 차단 검사:
스팸 검사를 다시 받지 않으려면 로그인하거나 혹은 가입 하세요.
...