1

I have a SlidingPaneLayout with a ListView in the left pane and a MapFragment in the right pane.

Her is my code:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SlidingPaneLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/sliding_pane_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

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

    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
              android:id="@+id/map"
              android:layout_height="match_parent"
              android:layout_width="300dp"
              android:layout_weight="1"
              android:name="com.google.android.gms.maps.MapFragment"/>
</android.support.v4.widget.SlidingPaneLayout>

The problem is when the SlidingPaneLayout is showed on a small screen (smaller then 200dp + 300dp in my case). Then the map cant be seen until the right pane is fully on screen. I want the map to be visible even when the left pane is on screen(visible to the right of the ListView).

Not like this. I want the right pane to show the map.

Is it possible, and how?

sogasg
  • 35
  • 7

1 Answers1

0

<ListView android:id="@+id/left_pane"
          android:layout_width="200dp"
          android:layout_height="match_parent"/>

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/map"
          android:layout_height="match_parent"
          android:layout_width="300dp"
          android:name="com.google.android.gms.maps.MapFragment"/>

From what I can tell, android:layout_gravity="left" and android:layout_weight="1" are both unnecessary. Everything else should be fine. I'm not sure what you're expecting. I have a feeling that the reason that the map can't be seen is a product of the map itself. Try replacing it with something else. It should show up just fine.

Sample reference: Exploring SlidingPaneLayout, How to use the SlidingPaneLayout

Steve P.
  • 14,489
  • 8
  • 42
  • 72
  • Thanks for the answer. Yes, with other views its showing fine. Its just the map that disappear when the left pane is on screen (for smaller screens). Btw.: I can even see that the map buttons for zoom is not disappearing as I swipe the map, but at once a swipe begins the map disappear. The android:layout_weight="1" is used to make the map span the whole screen when the screen is wider then 300dp. – sogasg Jun 10 '13 at 21:26