我正在编写一个实现嵌套选项卡的应用程序。因为两组选项卡占用了相当多的空间,而且一般因为内容的性质,我想将整个内部的 TabHost 放入一个可滚动的结构中。我可以制作外部活动FrameLayout、LinearLayout、甚至ViewFlipper的tabcontent;当我尝试使其成为 ScrollView 时,程序崩溃。
<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">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<ScrollView
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout>
</TabHost>
所以显然 TabHost 喜欢住在不可滚动的框架内。有没有办法解决这个问题而不会造成很多混乱?