본문 바로가기

Computer Science/Android

android 메뉴 탭

* In xml, 


<TabHost  

    xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"

  

    android:id="@+id/tabhost"  

    android:layout_width="fill_parent"  

    android:layout_height="fill_parent" >  

  

        <LinearLayout  

            android:layout_width="match_parent"  

            android:layout_height="match_parent"  

            android:orientation="vertical" >  

            <TabWidget  

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

                android:layout_width="fill_parent"  

                android:layout_height="wrap_content" >  

            </TabWidget>  

  

            <FrameLayout  

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

                android:layout_width="fill_parent"  

                android:layout_height="fill_parent" >  

               

                

                

                

            </FrameLayout>  

        </LinearLayout>  

    </TabHost>  



* id ; tabhost, tabs, tabcontent는 건들면 안됨.

* framelayout에 구현할메뉴 작성.


 

----------------------




* in code,


 1. TabHost 가져오기

 2. tabhost.setup()

 3. TabSpec 가져오기.

 4. TabSpec = tab 1개.



 5. tabspect.setindicator("tab 이름"); 

 6. tabsetcontent("tab을 채울 content의 id");

 7. tabhost.addtab(tabspect);



'Computer Science > Android' 카테고리의 다른 글

android fragment 관리  (0) 2013.11.07
android google map api  (0) 2013.11.07
android fragment  (0) 2013.11.02
android fragment  (0) 2013.10.30
android activity 전환  (0) 2013.10.29