0

我需要在 Webview 旁边显示一个 ListView(如 Master/Detail 示例),但我需要能够以不同的顺序对 ListView 进行排序(例如按类别或名称显示某些项目),但我做到了使用选项卡、下拉菜单或 SectionPagerAdapter 无法成功,因为 Master/Detail 示例使用 Fragment,而 TabHost 不是 Fragment。我对我应该使用的东西有点迷茫。

为了清楚起见,我想这样显示: 1

是否有一些使用这种视图的开源项目,或者你有什么建议来执行它?

4

1 回答 1

0

您也可以手动进行。只需将两个列表视图放在一起并更改它们的可见性,以便一次只显示一个。

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >

    <Button
        android:id="@+id/btn1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <Button
        android:id="@+id/btn2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:orientation="horizontal" >

    <FrameLayout
        android:layout_width="64dp"
        android:layout_height="match_parent" >

        <ListView
            android:id="@+id/list_view1"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

        <ListView
            android:id="@+id/list_view2"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    </FrameLayout>

    <WebView
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1" />
</LinearLayout>

这只是您可以使用的 UI 的骨架。

于 2014-01-10T14:59:03.960 回答