Android 布局中的TabHost NullPointerException
我一直在遵循谷歌提供的标签示例。我正在尝试使用提供的XML布局来设置选项卡布局 我使用这个XML布局@Android 布局中的TabHost NullPointerException,android,eclipse,Android,Eclipse,我一直在遵循谷歌提供的标签示例。我正在尝试使用提供的XML布局来设置选项卡布局 我使用这个XML布局@ 当我在Eclipse布局设计器中切换布局选项卡时,我在Eclipse中得到一个NullPointerException:null错误 当我尝试拖放TabHost,然后将TabWidget拖放到空布局文件中时,也会发生这种情况 我做错了什么?这似乎很简单。发现它已经被记录为一个问题 无论如何谢谢下面列出了示例代码的所有问题。 <?xml version="1.0" encoding=
当我在Eclipse布局设计器中切换布局选项卡时,我在Eclipse中得到一个NullPointerException:null错误
当我尝试拖放TabHost,然后将TabWidget拖放到空布局文件中时,也会发生这种情况
我做错了什么?这似乎很简单。发现它已经被记录为一个问题
无论如何谢谢下面列出了示例代码的所有问题。
<?xml version="1.0" encoding="utf-8"?>
<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">
<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">
<TextView
android:id="@+id/textview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="this is a tab" />
<TextView
android:id="@+id/textview2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="this is another tab" />
<TextView
android:id="@+id/textview3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="this is a third tab" />
</FrameLayout>
</LinearLayout>
</TabHost>