我已经阅读了http://developer.android.com/resources/articles/layout-tricks-stubs.html,它解释了如何使用 viewtub 作为布局的惰性包含。
这在我拥有的简单列表视图上运行良好,但是当我尝试在我的实际选项卡式布局中使用它时,一旦选项卡获得任何真实内容,它就会消失。
我已将所有选项卡和选项卡主机设置为使用 wrap_content 作为高度(以免将存根推开)
有没有人使用带有标签视图的存根?诀窍是什么?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabHost android:id="@android:id/tabhost" android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<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="wrap_content">
<ListView android:id="@+id/discqueue" android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<ListView android:id="@+id/instantqueue"
android:layout_width="fill_parent" android:layout_height="wrap_content" />
</FrameLayout>
<ViewStub android:id="@+id/stub_navigate"
android:inflatedId="@+id/panel_navigate" android:layout="@layout/pagination_bar"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_gravity="bottom" />
</LinearLayout>
</TabHost>
</LinearLayout>