Событие касания в MapView в Android - PullRequest
0 голосов
/ 15 октября 2011

Привет! Я использую вид карты в моем приложении. Он отображается правильно, но проблема в том, что когда я касаюсь вида карты, он не перемещается, если пользователь хочет увидеть близлежащее местоположение, он не может переместиться в это место. Можно сказать, что вид карты неотвечая на touchevent в моем макете. мой код макета

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

перемещается в другое место, когда к любому виду любого местоположения по умолчанию прикасается. Может ли кто-нибудь сказать, почему он не перемещается и что мне делатьчто на сенсорном событии он будет двигаться.

Ответы [ 2 ]

2 голосов
/ 17 октября 2011

Если я правильно понимаю вашу проблему, то, что, когда вы пытаетесь перемещаться по карте, она ничего не делает .. Это может помочь добавить эти две строки в ваш 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"
                 />

Поэтому попробуйте добавить две строки внутри вашего XML в объекте MapView, и он должен работать.

0 голосов
/ 18 октября 2011

Потрясающий учебник здесь http://mobiforge.com/developing/story/using-google-maps-android?page=1

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...