簡單的android.support.v4.app.FragmentTabHost的圖形佈局在Eclipse或Android Studio中都不會呈現。
控制檯的錯誤,我得到的是一致的:
Exception raised during rendering: No tab known for tag null
FragmentTabHost圖形佈局不會呈現
我使用最基本的XML文件:
<android.support.v4.app.FragmentTabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TabWidget
android:id="@android:id/tabs"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0"/>
<FrameLayout
android:id="@+id/realtabcontent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>
</android.support.v4.app.FragmentTabHost>
但發生同樣的錯誤。
我只是想在標籤小部件和框架佈局的上方或下方添加更多視圖。
我不太在意看標籤內容;我只想看到我的佈局 - 的其餘部分,但問題是當android.support.v4.app.FragmentTabHost
駐留在佈局中時沒有呈現任何其他視圖。
我已閱讀並試圖從這個問題的答案後解決問題:
Android: Tabs at the bottom with FragmentTabHost
但我不認爲這是我的問題;我不打算把TabWidget放在底部。
我的其他XML文件之一完美打開。發生在Android Studio中
同樣的問題:
那是錯誤的logcat或控制檯?如果logcat,請發佈。 – anthropomo
這是一個錯誤日誌:在日食: (例外渲染過程中提出的:沒有選項卡標籤空異常詳細已知的窗口登錄>顯示視圖>錯誤日誌) – lory105
FragmentTabHost不會顯示任何內容,該內容將被動態地添加。所以沒有問題他們。當你在代碼中添加標籤並測試它時應該工作。 http://www.androidhive.info/2011/08/android-tab-layout-tutorial/ – mipreamble