5
我是Android应用程序开发的新手,我必须创建一个离线地图Android应用程序。在Android上创建离线地图
我使用Mobile Atlas Creator来获取地图视图osmdroid .zip格式,我不知道如何将它添加到我的应用程序中。
有人可以告诉我如何在我的应用程序中使用Osmdroid吗?如果您能提供分步说明,我将不胜感激。
我是Android应用程序开发的新手,我必须创建一个离线地图Android应用程序。在Android上创建离线地图
我使用Mobile Atlas Creator来获取地图视图osmdroid .zip格式,我不知道如何将它添加到我的应用程序中。
有人可以告诉我如何在我的应用程序中使用Osmdroid吗?如果您能提供分步说明,我将不胜感激。
这是一个绝对最小的示例项目,我之前做了Osmdroid。
package osmdemo.demo;
import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.MapController;
import org.osmdroid.views.MapView;
import android.app.Activity;
import android.os.Bundle;
// This is all you need to display an OSM map using osmdroid
public class OsmdroidDemoMap extends Activity {
private MapView mMapView;
private MapController mMapController;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.osm_main);
mMapView = (MapView) findViewById(R.id.mapview);
mMapView.setTileSource(TileSourceFactory.MAPNIK);
mMapView.setBuiltInZoomControls(true);
mMapController = mMapView.getController();
mMapController.setZoom(13);
GeoPoint gPt = new GeoPoint(51500000, -150000);
//Centre map near to Hyde Park Corner, London
mMapController.setCenter(gPt);
}
}
有这个在您的osm_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/mapview" />
</LinearLayout>
包含在构建路径slf4j-android-1.5.8.jar
和osmdroid-android-3.0.5.jar
。 (谷歌搜索从哪里得到它们)
thx为答案你能告诉我如何调用从移动阿特拉斯造物主提取的意见或它是自动的? – Adams
这是自动的,只需将zip文件放入您的手机的文件夹/ sdcard/osmdroid – NickT
thx NickT它的工作可以告诉我只是在模拟器中的哪个文件夹我把图片.zip thx – Adams