Tabhost tutorial broken? [duplicate]

≡放荡痞女 提交于 2019-12-05 16:18:05

Use this template:

<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent">
    <LinearLayout
        android:id="@+id/tab"    android:orientation="vertical"        android:layout_width="fill_parent"   android:layout_height="fill_parent">
        <TabWidget
            android:id="@android:id/tabs"    android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
        <FrameLayout
            android:id="@android:id/tabcontent"            android:layout_width="fill_parent"     android:layout_height="fill_parent">

            <LinearLayout android:id="@+id/tab1" android:layout_width="fill_parent"
             android:layout_height="fill_parent" android:orientation="vertical"/>

            <LinearLayout android:id="@+id/tab2" android:layout_width="fill_parent"
             android:layout_height="fill_parent" android:orientation="vertical"/>

</FrameLayout>
</LinearLayout>
</TabHost>

See step 5 , your Activity must extend TabActivity, not Activity

Now open HelloTabWidget.java and make it extend TabActivity:

Switch to android target 3.0 or 3.1 in the graphical layout itself. You can find the drop down list on the top right corner

Angerico Cariño

You can use the updated rendering library found here: Android Tools.

Just extract the directories found in \layoutlib\[platform version] to \[sdk dir]\platforms\[platform version] and let it override the layoutlib.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!