2014-10-05 140 views
3

我正在做一个Android应用程序,实现谷歌地图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" /> 

帮助不胜感激。

感谢

回答

4

抽屉布局必须在布局文件的根元素,像这样:

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

真棒:-)非常感谢你 – user1972670 2014-10-05 13:08:06