使用Google地图绘制DrawerLayout

Dog*_*oge 7 android android-layout

我将Google的DrawerLayout置于带有地图片段的活动中时遇到问题.我没有尝试使用MapView,但我担心问题会保持不变.

我在支持库(v13)中使用谷歌的DrawerLayout,并在其中放置一个地图.

通过图像可以更好地解释我遇到的问题......在2.2-2.3(4.0+以上)上,如果在绘制谷歌地图片段的任何地方,抽屉都不会出现.视图的其余部分以及视图上的小部件都会正确显示阴影,但不会显示地图.

这是我的xml布局

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

这是在2.x设备上看到的,屏幕截图是在Android调试监视器中拍摄的,方块应该是我的DrawerLayout按钮之一

Android 2.x

它应该是这样的:

Android 4.x

我担心这是由于Gmaps对象是在FrameLayout上绘制的,但我真的不知道.

有人遇到过这个问题或有关于如何解决的想法?谢谢.

Shi*_*iun 10

我遇到了这个问题,我尝试了这个解决方案:https://stackoverflow.com/a/16231935/267559.它对我有用.请试一试.