이것은 내가 언젠가 만든 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
을 포함하여이 되세요. (어디에서 얻을 수 있는지에 대한 Google 검색)
thx 답변 모바일 아틀라스 크리에이터에서 추출한보기를 호출하는 방법 또는 자동으로 표시 할 수 있습니까? – Adams
그것은 자동이다, 당신의 전화에 폴더/sdcard/osmdroid에 zip 파일을 그냥 내 보낸다. – NickT
thx NickT 그것이 작동했는지 어느 폴더에있는 시뮬레이터에 내게 말해 줄 수 있니? .zip thx – Adams