2011-10-15 74 views
0

您好我在我的application.it中使用mapview正确显示,但问题是当我触摸地图查看其不移动,如果用户想看到他不能移动到该位置的附近位置。可以说,MapView的没有响应我layout.here到的TouchEvent是我的布局代码在Android中的MapView触摸事件

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="#FFFFFF"> 
    <TextView 
    android:id="@+id/name" 
    android:layout_width="fill_parent" 
    android:layout_height="50px" 
    android:textSize="20sp" 
    /> 
    <TextView 
    android:id="@+id/link" 
    android:layout_width="fill_parent" 
    android:layout_height="50px" 
    android:autoLink="web"/> 
    <TextView 
    android:id="@+id/department" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    /> 
    <TextView 
    android:id="@+id/count" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"/> 
    <TextView 
    android:id="@+id/location" 
    android:layout_width="fill_parent" 
    android:layout_height="80px" /> 
    <LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" > 
    <TextView 
    android:id="@+id/longitude" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_weight="1"/> 
    <TextView 
    android:id="@+id/latitude" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_weight="1"/> 
    </LinearLayout> 
    <LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal"> 
    <Button 
    android:id="@+id/zoomin" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_weight="1" 
    android:text="ZoomIn"/> 
<Button 

android:id="@+id/zoomout" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:layout_weight="1" 
android:text="Zoom Out"/> 

    </LinearLayout> 
    <com.google.android.maps.MapView 
    android:id="@+id/mapview" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:apiKey="0PmsmqKFKflNmHXD2fwG_vPWnR2gA-YB2QVlIQA" 
       android:layout_weight="2" 
       /> 

</LinearLayout> 

移动到不同的位置,当任的观点是任何位置,默认情况下,触摸任何一个可以告诉为什么它不动,什么我应该这样做,触摸事件它会移动。

+0

mapview当我们在android中更改时更改默认情况下? –

回答

2

如果我正确理解你的问题是它当您尝试在地图上四处移动它没有做任何事情。它可能有助于theese两行添加XML内部

android:enabled="true" 
android:clickable="true" 

它应该看起来像这里面的您的片段:

<com.google.android.maps.MapView 
    android:id="@+id/mapview" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:apiKey="0PmsmqKFKflNmHXD2fwG_vPWnR2gA-YB2QVlIQA" 
       android:layout_weight="2" 
       android:enabled="true" 
       android:clickable="true" 
       /> 

所以尝试的MapView对象添加XML里面的两行,它应该工作。