2012-04-19 50 views
1

对于我的问题(如下图),这是我目前的布局:Android的谷歌地图自定义布局

<?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的活动中这样做,因为我唯一能做到这一点的方法是将视图移动到菜单选项。

在此先感谢。

回答

1

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

1

只是尝试移动你的com.google.android.maps.MapView部分首先它的兄弟姐妹意见。

+0

不起作用。如果我这样做,似乎在mapview背后的部分ommited,我的代码不能找到location_banner的ID。 – FilipPudak 2012-04-19 09:36:50

+0

对我来说,com.google.android.maps.MapView'(我的意思是在这个布局文件中)上面的部分是看不到的。如果您在布局文件中交换视图位置,则应该执行** clean **。 – 2012-04-19 10:08:11