2011-07-23 47 views
0

目前,我有這個錯誤,我認爲是在蝕故障:多年來與TabHost錯誤騎日食

Error during post inflation process: 
TabHost requires a TabWidget with id "android:id/tabs". 
View found with id 'tabs' is 'com.android.layoutlib.bridge.MockView' 

The following classes could not be found: 
- TabWidget 

這顯然是與此代碼的問題:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <LinearLayout android:id="@+id/linearLayout1" 
     android:layout_width="fill_parent" android:layout_height="wrap_content" 
     android:orientation="vertical" android:background="@drawable/bkgrnd"> 
     <RelativeLayout android:layout_height="wrap_content" 
      android:id="@+id/relativeLayout1" android:layout_width="wrap_content"> 
      <ImageView android:layout_width="wrap_content" android:src="@drawable/quizicon" 
       android:layout_height="wrap_content" android:id="@+id/imageView1" 
       android:layout_alignParentLeft="true" android:layout_alignParentTop="true"></ImageView> 
      <TextView android:id="@+id/textView1" android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_centerHorizontal="true" 
       android:layout_alignParentTop="true" android:textSize="@dimen/menuTitleSize" 
       android:text="@string/scores"></TextView> 
      <ImageView android:layout_width="wrap_content" android:src="@drawable/quizicon" 
       android:layout_height="wrap_content" android:id="@+id/imageView2" 
       android:layout_alignParentRight="true" 
       android:layout_alignParentTop="true"></ImageView> 
     </RelativeLayout> 

     <TabHost android:id="@android:id/tabhost" 
      android:layout_width="fill_parent" android:layout_height="fill_parent"> 
      <LinearLayout android:id="@+id/linearLayout2" 
       android:layout_width="fill_parent" android:layout_height="fill_parent" 
       android:orientation="vertical"> 
       <TabWidget android:layout_width="fill_parent" 
        android:layout_height="wrap_content" android:id="@android:id/tabs"></TabWidget> 
       <FrameLayout android:layout_width="fill_parent" 
        android:layout_height="fill_parent" android:id="@android:id/tabcontent"> 
        <TableLayout android:id="@+id/TableLayout_AllScores" 
         android:layout_height="fill_parent" android:layout_width="fill_parent" 
         android:stretch_columns="*"></TableLayout> 
        <TableLayout android:id="@+id/TableLayout_FriendScores" 
         android:layout_height="fill_parent" android:layout_width="fill_parent" 
         android:stretch_columns="*"></TableLayout> 
       </FrameLayout> 
      </LinearLayout> 
     </TabHost> 

    </LinearLayout> 
</LinearLayout> 

由於這是eclipse出錯,代碼實際上是正確的,有沒有辦法來覆蓋錯誤,所以它會讓我編譯。

回答

0

這不是一個很好的答案,但日食有時列出了不存在的錯誤,經過詳盡的調試後,如果我無法找到答案,我已經通過從錯誤列表中刪除錯誤並清理項目,然後構建項目。

羅南