7

Google の DrawerLayout をマップ フラグメントを含むアクティビティに配置すると、問題が発生します。MapView を試したことはありませんが、問題は変わらないのではないかと心配しています。

サポート ライブラリ (v13) から Google の DrawerLayout を使用し、その中にマップを配置しています。

私が抱えている問題は、画像を介してよりよく説明されています... 2.2-2.3 (4.0 以降では問題ありません) では、Google マップのフラグメントが描画されている場所にある場合、引き出しは表示されません。ビューの残りの部分は、ビュー上のウィジェットとともに適切にシェーディングされますが、マップはシェーディングされません。

ここに私の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 のボタンの 1 つです。

アンドロイド 2.x

これはどのように見えるべきかです:

Android 4.x

これは、Gmaps オブジェクトが FrameLayout に描画されていることが原因なのではないかと心配していますが、よくわかりません。

誰かがこの問題に遭遇したり、解決方法についてアイデアを持っていますか? ありがとう。

4

1 に答える 1

10

この問題に遭遇し、この解決策を試みました: https://stackoverflow.com/a/16231935/267559。それは私のために働いた。ぜひお試しください。

于 2013-06-24T17:08:12.897 に答える