Android OpenStreetMap 显示标记而不是地图

Android OpenStreetMap shows marker instead of map

我正在开发 Android 应用程序。我需要定位用户。所以我想使用 Google OpenStreetMap。我想将打开的街景集成到我的应用程序中,但是当应用程序启动时,地图没有加载。相反,我只得到一个标记。这是我的代码:

import org.osmdroid.views.MapView;
import org.osmdroid.views.overlay.MyLocationOverlay;

import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.os.Bundle;

public class MainActivity extends Activity {

    MyItemizedOverlay myItemizedOverlay = null;
    MyLocationOverlay myLocationOverlay = null;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        MapView mapView = (MapView) findViewById(R.id.button1);
        mapView.setBuiltInZoomControls(true);

        Drawable marker = getResources().getDrawable(
                android.R.drawable.star_big_on);
        int markerWidth = marker.getIntrinsicWidth();
        int markerHeight = marker.getIntrinsicHeight();
        marker.setBounds(0, markerHeight, markerWidth, 0);

        ResourceProxy resourceProxy = new DefaultResourceProxyImpl(
                getApplicationContext());

        myItemizedOverlay = new MyItemizedOverlay(marker, resourceProxy);
        mapView.getOverlays().add(myItemizedOverlay);

        GeoPoint myPoint1 = new GeoPoint(0 * 1000000, 0 * 1000000);
        myItemizedOverlay.addItem(myPoint1, "myPoint1", "myPoint1");
        GeoPoint myPoint2 = new GeoPoint(50 * 1000000, 50 * 1000000);
        myItemizedOverlay.addItem(myPoint2, "myPoint2", "myPoint2");

        myLocationOverlay = new MyLocationOverlay(this, mapView);
        mapView.getOverlays(`enter code here`).add(myLocationOverlay);
        myLocationOverlay.enableMyLocation();    
    }
} 

感谢您的帮助。

您没有设置磁贴源。请适当地在您的 MapView 对象上调用 setTileSource()

请不要混淆术语,没有 "google open street maps"。该项目称为 OpenStreetMap(末尾没有 s)并且根本不涉及 Google。