我正在尝试创建一个在滑动窗格中具有 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>