user1972670
user1972670

Reputation: 397

Android Google maps with navigation drawer layout

i'm making an android app that implements Google maps V2 maps.

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.

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

Upvotes: 3

Views: 6984

Answers (1)

Adam Jenkins
Adam Jenkins

Reputation: 55613

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>

Upvotes: 5

Related Questions