Anyone know what this error mean for android tabs?
I am trying to try out the tutorial online and wanted to put the tab to the layout xml. I have change the extends from Activity to TabActivity. In the design view of the layout xml, I have the below.
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:
I have looked for solution b开发者_JAVA百科ut none of them fixed except I found one in different language. I tried using the translator on google but not so helpful.
Does anyone manage to get the tabs function.
I am using Android 2.2 Api and develop with an eclipse IDE
Known bug http://code.google.com/p/android/issues/detail?id=13092
A user suggested to switch build target to 1.6 and the issue goes away. Obviously a temporary fix.
You need a layout like this:
<?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"
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>
See the Tab Layout tutorial for more info.
Do you have a TabWidget with id android:id/tabs as the error message tells you you need?
Switch to android Target 3.0 or 3.1. You can find that drop down list on the top right side
I had the same issue. The workaround is detailed in this link:
Comment 63 by blundell...@gmail.com, May 5, 2011
As stated above Quick Fix: Just change the API Target (top left of XML graphical view) to 3.0 and you can see it
精彩评论