【问题标题】:Android Google maps with navigation drawer layout带有导航抽屉布局的 Android 谷歌地图
【发布时间】:2014-10-05 20:49:36
【问题描述】:

我正在制作一个实现 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" />

非常感谢您的帮助。

谢谢

【问题讨论】:

    标签: android google-maps navigation-drawer


    【解决方案1】:

    抽屉布局必须是布局文件中的根元素,如下所示:

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

    【讨论】:

      猜你喜欢
      • 2014-05-18
      • 2016-02-18
      • 1970-01-01
      • 1970-01-01
      • 2017-01-22
      • 2016-01-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多