Android谷歌地图自定义布局

标签 android view 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>

我想在非 map View 部分启用一些点击监听器。

是否有可能在扩展 Mapactivity 的 Activity 中执行此操作,因为我能够执行此操作的唯一方法是将我的 View 移动到菜单选项。

提前致谢。

最佳答案

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

关于Android谷歌地图自定义布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10225057/

相关文章:

android - 在 Eclipse 中为 ndk 程序设置构建路径

ios - 如何使用 2 个 View 从 IOS 应用程序发送电子邮件?

swift - 使用自动布局将 3 个 ImageView 实际放置在相同的高度

javascript - 将 lat/lng 坐标转换为给定 map 上的像素(使用 JavaScript)

R - 绘制 netcdf 气候数据

android - Android ABI 的目标 exe(ndk 构建)

android - windowSoftInputMode ="adjustResize"不适用于半透明 Action /导航栏

安卓错误 : thread exiting with uncaught exception (group=0x40015560)

xml - Powershell和Lotus Notes-将While循环的输出从文本更改为XML输出

javascript - 使用一些 map API 突出显示整条街道