2013-10-11 6 views
12

I einfaches Layout Struktur haben:Android MapView überlappt DrawerLayout

DrawerLayout 
\-- FrameLayout // @+id/fragment_container 
\-- ListView // @+id/drawer_list 

von jeder Schublade Element klicken ich Einfügen/ersetzen Fragment über FragmentTransaction.replace() in R.id.fragment_container mit Fragment Instanz entspricht. Eines dieser Fragmente enthält MapView.

Und es hat Rendering-Probleme auf verschiedenen Geräten, aber zur gleichen Zeit zeigt DDMS mir rechts Screenshot.

EDITED

Ausgabe erscheint auf solchen Geräten:

  • Huawei U9508, Android 4.0.4 (API 15)
  • HTC Desire A9191, Android 2.3.5 (API 10)

Es gibt no issue auf solchen Geräten:

  • Samsung Galaxy S2 mit CyanogenMod Android 4.2.2 (API 17)
  • LG Google Nexus 4 Android 4.3 (API 18)

Könnte jemand Hilfe ich dieses Problem zu verstehen und zu beheben?

Bilder ansehen:

Huawei U9508, Android 4.0.4 (API 15)

enter image description here enter image description here enter image description here

HTC Desire A9191, Android 2.3.5 (API 10)

enter image description here

DDMS

enter image description here

EDITED

Aktivität Layout:

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

    <!-- The main content view --> 
    <FrameLayout 
      android:id="@+id/fragment_container" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      /> 

    <!-- The navigation drawer --> 
    <ListView 
      android:id="@+id/drawer_list" 
      android:layout_width="240dp" 
      android:layout_height="match_parent" 
      android:orientation="vertical" 
      /> 
</DrawerLayout> 

Fragment Layout:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     > 

    <!-- other views here --> 

    <com.google.android.gms.maps.MapView 
      android:id="@+id/consumer_profile_map" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      /> 
</RelativeLayout> 
+0

MapView gierig ist –

+0

was meinst du? Wie vermeide ich das? –

+0

Sry für OT, aber bist du aus Nürnberg? –

Antwort

27

So finde ich Abhilfe: nur in den Container wickeln und leeren View oben.Dank dieser Antwort: https://stackoverflow.com/a/16231935/1891118

Es ist meine aktualisierte Layout:

<FrameLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     > 

    <com.google.android.gms.maps.MapView 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      /> 

    <View 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      /> 
</FrameLayout> 
+0

Vielen Dank, es hat mir auch bei einem ähnlichen Fall geholfen, aber ich verwende ein VideoView anstelle eines MapView. –

+0

Funktioniert auch mit 'ru.yandex.yandexmapkit.MapView'. Eine einfache und elegante Lösung! – kit