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>
謝謝你的回答,有沒有這樣的風格的一些例子,你可以指向我? – tinker
我見過Google+ android應用程序這樣做 – tinker
@tinker:你有什麼證據證明Google+應用程序正在使用「SlidingPaneLayout」? AFAIK,他們使用'DrawerLayout'(或他們自己的工作),這是一個完全獨立的東西(儘管與一些UI的相似之處)。 – CommonsWare