【发布时间】:2015-12-14 00:43:12
【问题描述】:
我有一个带有各种标签的应用程序(在标签主机上)。每个选项卡都是一个扩展活动的活动,上面有一些textfields 和一些东西。
现在,我需要我的选项卡包含在列表视图中,但在 Android 开发人员指南的示例中,您必须扩展 ListActivity 而不是 Activity。
基本上,我需要合并这两个教程:
如何在课堂上使用listview 而不扩展listactivity?
我的 XML 文件:
<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>
【问题讨论】: