[英]Android Google maps with navigation drawer layout
i'm making an android app that implements Google maps V2 maps. 我正在制作一个实现谷歌地图V2地图的Android应用程序。
When i implement the include layout tag, map fragment doesn't register clicks or any type of input from the screen. 当我实现包含布局标记时,地图片段不会在屏幕上注册点击或任何类型的输入。 but when i remove the include tag, i can move the map around.
但是当我删除包含标签时,我可以移动地图。
I've done goggling around but i couldn't find anything that could help. 我已经做得很好,但我找不到任何有用的东西。
i've also tried this thread Google Maps V2 + Drawer Layout but without success. 我也试过这个线程谷歌地图V2 +抽屉布局,但没有成功。
Here's my 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" />
Help greatly appreciated. 非常感谢。
Thanks 谢谢
The drawer layout must be the root element in the layout file, like so: 抽屉布局必须是布局文件中的根元素,如下所示:
<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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.