12

我有简单的布局结构:

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

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

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

已编辑

此类设备上出现问题:

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

no issue在这样的设备上有:

  • 三星 Galaxy S2与 CyanogenMod Android 4.2.2 (API 17)
  • LG 谷歌 Nexus 4安卓 4.3 (API 18)

有人可以帮我理解和解决这个问题吗?

见图片:

华为U9508,安卓4.0.4(API 15)

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

HTC Desire A9191,安卓 2.3.5 (API 10)

在此处输入图像描述

数据管理系统

在此处输入图像描述

已编辑

活动布局:

<?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>

片段布局:

<?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>
4

1 回答 1

30

因此,我找到了解决方法:只需将其包裹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>
于 2013-10-14T07:20:33.673 回答