2013-06-14 24 views
7

Ich habe ein Problem mit Google DrawerLayout, wenn es in einer Aktivität mit einem Kartenfragment platziert wird. Ich habe es nicht mit einem MapView versucht, aber ich fürchte, das Problem würde gleich bleiben.DrawerLayout mit Google Maps

Ich verwende googles DrawerLayout aus der Support-Bibliothek (v13) und platziere eine Karte darin.

Das Problem, das ich habe, wird besser durch Bilder erklärt ... Unter 2.2-2.3 (gut auf 4.0+) erscheint die Schublade nicht, wenn es dort ist, wo das Google Map-Fragment gezeichnet wird. Der Rest der Ansicht und die Widgets in der Ansicht werden ordnungsgemäß schattiert, nicht jedoch die Karte.

Hier ist mein xml Layout

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.DrawerLayout 
     xmlns:map="http://schemas.android.com/apk/res-auto" 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 
    <LinearLayout 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:orientation="vertical" 
      android:weightSum="4"> 
     <fragment 
       android:id="@+id/map" 
       android:layout_width="match_parent" 
       android:layout_height="0dp" 
       android:layout_weight="3" 
       android:name="com.google.android.gms.maps.SupportMapFragment" 
       android:scrollingCache="false" 
       map:cameraTargetLat="39.828325" 
       map:cameraTargetLng="-98.579728" 
       map:cameraZoom="2" 
       map:cameraTilt="0" 
       map:cameraBearing="0"/> 
     <LinearLayout 
       android:id="@+id/map_fragmentHolder" 
       android:layout_height="0dp" 
       android:layout_width="match_parent" 
       android:orientation="vertical" 
       android:layout_weight="1" /> 
    </LinearLayout> 
    <include 
     layout="@layout/menu_layout" 
     android:layout_height="wrap_content" 
     android:layout_width="match_parent" 
     android:layout_gravity="start" /> 

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

Hier ist, was auf 2.x-Geräte zu sehen ist, wird der Screenshot im Android Debug-Monitor genommen, und der Platz sollte eine meiner DrawerLayout die Tasten

sein

Android 2.x

Dies ist, wie es aussehen sollte:

Android 4.x

Ich habe Bedenken, dass dies durch die Tatsache verursacht wird, dass das Gmaps-Objekt auf einem FrameLayout gezeichnet wird, aber ich weiß es nicht wirklich.

Wer ist in dieses Problem hineingeraten oder hat Ideen zur Lösung? Vielen Dank.

+1

Ich bekomme das Problem auch. Schlimmer ist, dass ich es auf einem Telefon mit 4.0.3 erfahre. Keine Probleme auf Geräten mit Jelly Bean. –

Antwort

10

Ich stieß auf dieses Problem und ich versuchte diese Lösung: https://stackoverflow.com/a/16231935/267559. Es hat für mich funktioniert. Bitte versuchen Sie es.

+0

Ausgezeichnet, das hat perfekt funktioniert! Danke Shiun. – Doge

+1

BTW, ein transparentes FrameLayout funktioniert auch und ist scheinbar leichter als View. Probieren Sie es aus. – Shiun