안드로이드

탭뷰 스크롤

newkie 2015. 6. 9. 09:47


    <TabHost

        android:id="@+id/tabhost"

        android:layout_width="match_parent"

        android:layout_height="match_parent" >


        <LinearLayout

            android:layout_width="match_parent"

            android:layout_height="match_parent"

            android:orientation="vertical" >

                <HorizontalScrollView

                    android:id="@+id/hsTab"

                    android:layout_width="match_parent"

                    android:layout_height="wrap_content"

                    android:fillViewport="true"

                    android:scrollbars="none" >


                    <TabWidget

                        android:id="@android:id/tabs"

                        android:layout_width="wrap_content"

                        android:layout_height="wrap_content" >

                    </TabWidget>

                </HorizontalScrollView>


            <FrameLayout

                android:id="@android:id/tabcontent"

                android:layout_width="match_parent"

                android:layout_height="match_parent" >


                    <include

                        android:id="@+id/iTab"

                        android:layout_width="match_parent"

                        android:layout_height="wrap_content"

                        layout="@layout/tab_layout" />

            </FrameLayout>

        </LinearLayout>

    </TabHost>


탭 4개쯤 되니까 스크롤 자동으로 생기고 옆으로 휙휙 넘어감.