当 Google 的 DrawerLayout 被放置在带有 map fragment 的 Activity 中时,我遇到了问题。我还没有尝试过 MapView,但我担心问题会保持不变。

我正在使用支持库 (v13) 中的 google 的 DrawerLayout,并在其中放置了一张 map 。

我的问题可以通过图像更好地解释......在 2.2-2.3(在 4.0+ 上很好),如果在绘制谷歌 map fragment 的任何地方都结束了,抽屉就不会出现。 View 的其余部分以及 View 上的小部件会正确着色,但不会对 map 进行着色。

这是我的 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>

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

这是它的外观:

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

有人遇到过这个问题或对如何解决有想法吗?谢谢。

最佳答案

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

10-07 19:40
查看更多