Android谷歌地图自定义布局

时间:2012-04-19 09:16:54

标签: android views maps

对于我的问题(如下),这是我目前的布局:

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

我想在不是mapview的部分上启用一些点击侦听器。

甚至可以在扩展Mapactivity的活动中执行此操作,因为我能够执行此操作的唯一方法是将视图移动到菜单选项。

提前致谢。

2 个答案:

答案 0 :(得分:1)

尝试将com.google.android.maps.MapView部分移到其所有兄弟视图之上。

答案 1 :(得分:1)

是的,您可以在MapActivity上实现Onclick侦听器。

相关问题