Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android MapView overlaps DrawerLayout

I have simple layout structure:

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

By clicking of any drawer item I'm inserting/replacing fragment via FragmentTransaction.replace() into R.id.fragment_container with corresponding Fragment instance. One of those Fragments contains MapView.

And it has rendering problems on different devices, but at the same time DDMS shows me right screenshot.

EDITED

Issue appears on such devices:

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

There is no issue on such devices:

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

Could anybody help me to understand and fix this problem?

See images:

Huawei U9508, Android 4.0.4 (API 15)

enter image description hereenter image description hereenter image description here

HTC Desire A9191, Android 2.3.5 (API 10)

enter image description here

DDMS

enter image description here

EDITED

activity 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>
like image 866
Oleksii K. Avatar asked Oct 11 '13 09:10

Oleksii K.


1 Answers

So, I find workaround solution: just wrap MapView into container and place empty View above. Thanks to this answer: https://stackoverflow.com/a/16231935/1891118

There is my updated 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>
like image 193
Oleksii K. Avatar answered Oct 23 '22 10:10

Oleksii K.