小编Ray*_*Ray的帖子

无法平移或移动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>
Run Code Online (Sandbox Code Playgroud)

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

}
Run Code Online (Sandbox Code Playgroud)

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

android osmdroid

1
推荐指数
1
解决办法
2471
查看次数

标签 统计

android ×1

osmdroid ×1