2013-03-31 44 views
1

我在示例应用程序中使用osmdroid映射。看到地图,缩放工程,一切都很好,但我无法平移/移动地图。无法平移或移动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); 
} 

} 

任何想法,如何使运动?

回答

0

现在就安装以前的版本,看起来像是3.0.9中的一个bug。

+1

我也经历过这个。其他人在gCode网站上提出了一个问题:https://code.google.com/p/osmdroid/issues/detail?id=415&start=100 –

6

尝试删除:

android:clickable="true" 

从你的MapView。这使得MapView消耗触摸事件,并且与dispatchTouchEvent方法混淆。你也可以尝试删除可调焦的东西。

0

尝试使用

mapView.setClickable(false); 
2
mapView.setClickable(false); 

它为我工作。

你应该试试看。