安卓谷歌地图与导航抽屉布局

3
我正在制作一个实现 Google maps V2 的 Android 应用程序。但是,当我实现包含布局标签时,地图片段无法从屏幕接收点击或任何输入。但是,当我删除包含标签时,就可以移动地图了。我已经查过一些资料,但是没有找到任何有用的信息。我也尝试了这个线程 Google Maps V2 + Drawer Layout,但是没有成功。以下是我的布局代码:
<FrameLayout
    android:id="@+id/content_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <fragment
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        class="com.google.android.gms.maps.SupportMapFragment" />
</FrameLayout>

<include layout="@layout/navigation_drawer" />

非常感谢您的帮助。

谢谢

1个回答

5
抽屉式布局必须作为布局文件的根元素,如下所示:
<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <!-- google map -->
    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:name="com.google.android.gms.maps.MapFragment"/>

</android.support.v4.widget.DrawerLayout>

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接