Eclipse add tabhost to project error
When I am trying to add a Ta开发者_JS百科bHost using
RightClick > New > Android XML > Select Root Element :TabHost
It shows tabhost need a tabwidget and frame layout.
Actually tabhost is the root. How I can have a tabwidget and frame layout before ?
Is that fault of eclipse or mine ?
This feature should work as you described after installing ADK 2.3.3 update 2, using Eclipse 3.7.1.
I was able to create layout with root TabHost as you described on eclipse 3.7.1 with no errors. I belive as workaround you can create layout with LinearLayout as root and then either put TabHost inside it or switch LinearLayout with TabHost.
edit:
<?xml version="1.0" encoding="utf-8"?>
<TabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</TabWidget>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</FrameLayout>
</TabHost>
精彩评论