1

我在示例应用程序中使用 osmdroid 映射。可以看到地图,缩放工作,一切都很好,除了我无法平移/移动地图。

我的主要xml代码是:

 <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代码是:

 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);
}

}

关于如何启用运动的任何想法?

4

4 回答 4

6

尝试删除:

android:clickable="true"

从您的地图视图。这使得 MapView 消耗触摸事件,并与 dispatchTouchEvent 方法混淆。您也可以尝试删除可聚焦的东西。

于 2013-04-06T02:48:35.463 回答
2
mapView.setClickable(false);

它对我有用。

你应该试一试。

于 2013-07-23T13:52:01.277 回答
0

现在只安装以前的版本,看起来 3.0.9 中存在错误。

于 2013-03-31T17:47:43.450 回答
0

尝试使用

mapView.setClickable(false);
于 2013-06-19T08:56:03.453 回答