当我尝试使用
添加TabHost时RightClick > New > Android XML > Select Root Element :TabHost
它显示tabhost需要tabwidget和框架布局。
实际上tabhost是根。我之前如何拥有 tabwidget 和框架布局?
是日食还是我的错?
答案 0 :(得分:1)
使用Eclipse 3.7.1安装ADK 2.3.3 update 2后,此功能应该如您所述。
答案 1 :(得分:0)
我能够使用root TabHost创建布局,正如您在eclipse 3.7.1中描述的那样没有错误。我相信你可以使用LinearLayout以root身份创建布局,然后将TabHost放入其中或使用TabHost切换LinearLayout。
修改强>
<?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>