【发布时间】:2016-04-20 11:52:57
【问题描述】:
我生成了一组地图,将其压缩为名称tiles.zip 并复制到sdcard/osmdroid 文件夹中。这里是atlas 设置和文件夹内容。
我使用了示例项目here。
它运行没有错误,但我的地图没有出现在MapView 中。这是 MainActivity 和布局:
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.MapView;
public class MainActivity extends AppCompatActivity {
public static final GeoPoint BERLIN = new GeoPoint(52.516667, 13.383333);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MapView mapView = (MapView) findViewById(R.id.mapview);
mapView.setClickable(true);
mapView.setBuiltInZoomControls(true);
mapView.setMultiTouchControls(true);
mapView.setUseDataConnection(true);
mapView.setTileSource(TileSourceFactory.MAPQUESTOSM);
IMapController mapViewController = mapView.getController();
mapViewController.setZoom(15);
mapViewController.setCenter(BERLIN);
}
}
和
<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="${packageName}.${activityClass}">
<org.osmdroid.views.MapView
android:id="@+id/mapview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true" />
</RelativeLayout>
正如我测试的那样,如果我解压缩地图并将它们添加为assets,地图会显示但顺序错误。
知道有什么问题吗? 谢谢
编辑1
这是我的日志:
【问题讨论】:
-
看来问题出在读取目录期间(请看EDIT1
-
@Behy 你解决了这个问题吗!?我现在也有这个!