1

我正在尝试创建一个在滑动窗格中具有 MapFragment 的应用程序。该地图位于一个片段上,该片段滑入主要内容 ListView。但是,我无法完全隐藏 MapFragment,因为它的一部分始终在主视图中可见。这是我的代码

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                android:id="@+id/LinearLayout1"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:orientation="vertical"
                tools:context=".MainActivity" >

    <android.support.v4.widget.SlidingPaneLayout
            android:id="@+id/sliding_layout"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">


        <ListView
                android:id="@+id/postsView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_gravity="left"
                >
        </ListView>


            <fragment
                    android:id="@+id/map"
                    android:name="com.google.android.gms.maps.SupportMapFragment"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_gravity="right"

                    />


    </android.support.v4.widget.SlidingPaneLayout>

</LinearLayout>
4

1 回答 1

1

这就是 的性质SlidingPaneLayout。它总是显示对面窗格的一部分,以帮助向用户指示如何在窗格之间切换。我在它的 API 中没有看到任何选项来改变它,尽管有可能通过一种风格来做到这一点。

于 2014-02-14T15:57:30.167 回答