来自google android“HelloTabWidget”的教程有一个空指针错误

时间:2010-08-31 08:24:44

标签: android android-tabhost

当我在布局视图(eclipse)中查看以下xml文件时,我得到了NullPointerException:null消息,但是当我运行代码时,它有效,任何人都可以向我解释这个原因吗?

<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:orientation="vertical"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:padding="5dp">
        <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"
            android:padding="5dp"/>
        </LinearLayout>     
</TabHost>

1 个答案:

答案 0 :(得分:0)

问题在于Eclipse Layout视图还不支持TabHost控件。

相关问题