2014-02-14 36 views
1

我正试图创建一个在滑动窗格中具有MapFragment的应用程序。该地图位于一个片段中,该片段向主要内容(ListView)滑动。但是,我无法将MapFragment完全隐藏,因为在主视图上总是有一部分可见。 这里是我的代码无法将SlidingPaneLayout设置为隐形

<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> 

回答

1

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

+0

谢谢你的回答,有没有这样的风格的一些例子,你可以指向我? – tinker

+0

我见过Google+ android应用程序这样做 – tinker

+0

@tinker:你有什么证据证明Google+应用程序正在使用“SlidingPaneLayout”? AFAIK,他们使用'DrawerLayout'(或他们自己的工作),这是一个完全独立的东西(尽管与一些UI的相似之处)。 – CommonsWare