public class Explain extends TabActivity{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.explain);
       
        TabHost th = getTabHost();

        TabSpec ts1 = th.newTabSpec("Tab1").setIndicator("첫번째 탭");
        ts1.setContent(R.id.tab1);
        th.addTab(ts1);
       
        TabSpec ts2 = th.newTabSpec("Tab2").setIndicator("두번째 탭");
        ts1.setContent(R.id.tab2);
        th.addTab(ts2);
       
        TabSpec ts3 = th.newTabSpec("Tab3").setIndicator("세번째 탭");
        ts1.setContent(R.id.tab3);
        th.addTab(ts3);
     }
}

 

이거랑   XML은

    <TabHost android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent">
        <LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
            <TabWidget android:layout_width="match_parent" android:layout_height="60px" android:id="@android:id/tabs"></TabWidget>
            <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@android:id/tabcontent" android:paddingTop="64px">
                <LinearLayout android:layout_height="match_parent" android:layout_width="match_parent" android:id="@+id/tab1" android:text="first"></LinearLayout>
                <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab2" android:text="second"></LinearLayout>
                <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab3" android:text="third"></LinearLayout>
            </FrameLayout>
        </LinearLayout>
    </TabHost>

 

 

이렇게 했는데..

작동이 안되네요.ㅠ

인터넷 검색해서 관련 한 자료는 많아서 찾아봤는데, 그냥 TabSpec과 Indicator, Content 에 대한 설명이 다더라구요..

08-23 16:20:05.187: ERROR/AndroidRuntime(1658): Caused by: java.lang.IllegalArgumentException: you must specify a way to create the tab content
근데 이런 오류가 뜨는 걸로 봐서는 tab content를 제대로 명시하지 않았다는 것 같은데..

 

어떻게 명시를 해야되나요?ㅠ