0
我正嘗試使用osmdroid庫創建一個簡單的地圖活動
地圖顯示很好,但它不會滾動。我無法弄清楚問題所在。地圖不會滾動
下面是代碼:
活動onCreate方法
setContentView(R.layout.activity_main);
final MapView mapView = (MapView)findViewById(R.id.map);
mapView.setBuiltInZoomControls(true);
mapView.getController().setZoom(10);
mapView.getController().setCenter(new GeoPoint(52.221, 6.893));
ZoomControls mZoomControls = (ZoomControls)findViewById(R.id.zoomControls);
mZoomControls.setOnZoomInClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mapView.getController().zoomIn();
}
});
mZoomControls.setOnZoomOutClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mapView.getController().zoomOut();
}
});
和xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<org.osmdroid.views.MapView
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"/>
<ZoomControls
android:id="@+id/zoomControls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="10dp" />
</RelativeLayout>