Android MapView与DrawerLayout重叠

Ole*_* K. 12 android google-maps android-mapview drawerlayout

我有简单的布局结构:

DrawerLayout
\-- FrameLayout // @+id/fragment_container
\-- ListView    // @+id/drawer_list
Run Code Online (Sandbox Code Playgroud)

通过单击任何抽屉项目,我将插入/替换片段FragmentTransaction.replace()进入R.id.fragment_container相应的Fragment实例.其中一个片段包含MapView.

它在不同设备上存在渲染问题,但同时DDMS向我显示正确的屏幕截图.

EDITED

问题出现在此类设备上:

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

no issue这样的设备:

  • 三星Galaxy S2搭配CyanogenMod Android 4.2.2(API 17)
  • LG谷歌Nexus 4 Android 4.3(API 18)

有人能帮我理解并解决这个问题吗?

看图像:

华为U9508,Android 4.0.4(API 15)

在此输入图像描述 在此输入图像描述 在此输入图像描述

HTC Desire A9191,Android 2.3.5(API 10)

在此输入图像描述

DDMS

在此输入图像描述

EDITED

活动布局:

<?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>
Run Code Online (Sandbox Code Playgroud)

片段布局:

<?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>
Run Code Online (Sandbox Code Playgroud)

Ole*_* K. 29

所以,我找到了解决方法:只需将MapView容器装入容器中并放置在空的View上面.感谢这个答案:https://stackoverflow.com/a/16231935/1891118

有我更新的布局:

<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>
Run Code Online (Sandbox Code Playgroud)