FilipPudak
FilipPudak

Reputation: 79

Android google maps custom layout

For my question (below), this is my current layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:background="@drawable/verylightgrey" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="48dp"
        android:weightSum="10" >

        <TextView
            android:id="@+id/location_banner"
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:layout_weight="8"
            android:background="#9e0039" />

        <TextView
            android:layout_width="1dp"
            android:layout_height="fill_parent"
            android:background="@drawable/verylightgrey" />

        <ImageView
            android:id="@+id/location_directions"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_weight="2"
            android:src="@drawable/directions" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:weightSum="2" >

        <ImageView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:src="@drawable/map_satellite" />

        <ImageView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:src="@drawable/map_street" />
    </LinearLayout>

    <com.google.android.maps.MapView
        android:id="@+id/mapview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:apiKey="ladidadiomagadi"
        android:clickable="true"
        android:enabled="true" />

</LinearLayout>

I want to enable some click listeners on parts that are not mapview.

Is it even possible to do that in an activity that extends Mapactivity because the only way I have been able to do this is by moving my views to the menu options.

Thanks in advance.

Upvotes: 1

Views: 493

Answers (2)

Himanshu Mittal
Himanshu Mittal

Reputation: 225

Yes ,You can implement Onclick listener on MapActivity.

Upvotes: 1

Dot Cink
Dot Cink

Reputation: 381

Just try to move your com.google.android.maps.MapView part above all its sibling views.

Upvotes: 1

Related Questions