无法平移或移动osmdroid地图 [英] Unable to pan or move the osmdroid map

查看:145
本文介绍了无法平移或移动osmdroid地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的示例应用程序的osmdroid地图。用手机查阅地图,缩放的作品,一切只是我无法平移/移动地图的罚款。

I'm using the osmdroid map in a sample application. The map is seen,zoom works,and everything is fine except that i'm unable to pan/move the map.

我的主要XML code是:

My main xml code is:

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <org.osmdroid.views.MapView
        android:id="@+id/mapview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:clickable="true"
        android:focusable="true"
        android:focusableInTouchMode="true">

    </org.osmdroid.views.MapView>

 </RelativeLayout>

我的Java code是:

My java code is:

 public class MapTest extends Activity {

private MapView mapView;
private MapController mapController;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_map_test);
    mapView = (MapView) findViewById(R.id.mapview);
    mapView.setBuiltInZoomControls(false);
    mapView.setMultiTouchControls(true);
    mapController = this.mapView.getController();
    mapController.setZoom(10);
    GeoPoint mapCenter = new GeoPoint(17.4467, 78.4667);
    mapController.setCenter(mapCenter);
}

}

任何想法,如何使运动?

Any ideas as to how to enable the movement?

推荐答案

尝试删除:

android:clickable="true"

从图形页面。使的MapView消耗的触摸事件,并将其与dispatchTouchEvent方法弄乱。您也可以尝试删除也可调焦的东西。

from your MapView. That makes the MapView consume touch events and it messes with the dispatchTouchEvent method. You might also try removing the focusable stuff too.

这篇关于无法平移或移动osmdroid地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆