Android MapView平铺为空

Android MapView平铺为空,android,maps,Android,Maps,我试图根据用户的位置显示一张城市地图,可以在线和离线使用(以防信号不好)。出于某种原因,我可以显示地图视图,但我只得到一个空白瓷砖的空屏幕 你知道为什么会这样吗 什么是热门片段 MyItemizedOverlay myItemizedOverlay = null; MyLocationOverlay myLocationOverlay = null; MapController myMapController = null; @Override public V

我试图根据用户的位置显示一张城市地图,可以在线和离线使用(以防信号不好)。出于某种原因,我可以显示地图视图,但我只得到一个空白瓷砖的空屏幕

你知道为什么会这样吗

什么是热门片段

MyItemizedOverlay myItemizedOverlay = null;
    MyLocationOverlay myLocationOverlay = null;
    MapController myMapController = null;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {

        View rootView = inflater.inflate(R.layout.fragment_whats_hot, container, false);

        final MapView mapView = (MapView) rootView.findViewById(R.id.mapview);
        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);

        // save zip to sd
        AssetManager assetManager = getActivity().getAssets();
        InputStream is;
        String fileName = "map_new_haven.zip";    // the zip file lies in assets root
        String path = this.getActivity().getExternalFilesDir(null) + File.separator + fileName; // the path I save SD to

        File tileFile = new File(path);
        if(!tileFile.exists()) {
            try {
                is = assetManager.open(fileName);

                FileOutputStream fo = new FileOutputStream(path);

                byte[] b = new byte[1024];
                int length;
                while((length = is.read(b)) != -1) {
                    fo.write(b, 0, length);
                }

                fo.flush();
                fo.close();
                is.close();
            } catch (IOException  e) {
                e.printStackTrace();
            }
        }

        IArchiveFile[] archives = new IArchiveFile[1];
        archives[0] = ArchiveFileFactory.getArchiveFile(tileFile);

        // Simple implementation that extends BitmapTileSourceBase and nothing else
        ITileSource customTiles = new XYTileSource("MapQuest", null, 10, 14, 256, ".jpg");  // MapQuest is the name of the folder inside the zip (so zip is map.zip and inside it is a folder called MapQuest)

        MapTileModuleProviderBase[] providers = new MapTileModuleProviderBase[2];
        providers[0] = new MapTileFileArchiveProvider(new SimpleRegisterReceiver(getActivity().getApplicationContext()), customTiles, archives);    // this one is for local tiles (zip etc.)
        providers[1] =  new MapTileDownloader(TileSourceFactory.MAPNIK);    // MAPNIK web tile source

        mapView.setUseDataConnection(true);

        MapTileProviderArray tileProvider = new MapTileProviderArray(customTiles, 
                new SimpleRegisterReceiver(getActivity().getApplicationContext()), providers);
        TilesOverlay tilesOverlay = new TilesOverlay(tileProvider, getActivity().getApplicationContext());
        tilesOverlay.setLoadingBackgroundColor(Color.TRANSPARENT);  // this makes sure that the invisble tiles of local tiles are transparent so we can see tiles from web, transparent have a minor performance decline.

        mapView.getOverlays().add(tilesOverlay);

        mapView.invalidate();

        myLocationOverlay = new MyLocationOverlay(getActivity(), mapView);
        mapView.getOverlays().add(myLocationOverlay);

        myMapController = mapView.getController();
        myMapController.setZoom(3);

        ScaleBarOverlay myScaleBarOverlay = new ScaleBarOverlay(getActivity());
        mapView.getOverlays().add(myScaleBarOverlay);

        myLocationOverlay.runOnFirstFix(new Runnable() {
            public void run() {
             mapView.getController().animateTo(myLocationOverlay.getMyLocation());
               } 
           });

        return rootView;
    }
02-11 13:41:23.343: D/libc(26293): [NET] getaddrinfo+,hn 14(0x3139322e313633),sn(),family 0,flags 4
02-11 13:41:23.343: D/libc(26293): [NET] getaddrinfo-, SUCCESS
02-11 13:41:23.343: D/libc(26293): [NET] getaddrinfo+,hn 22(0x74696c652e6f70),sn(),family 0,flags 4
02-11 13:41:23.343: D/libc(26293): [NET] getaddrinfo-,err=8
02-11 13:41:23.343: D/libc(26293): [NET] getaddrinfo+,hn 22(0x74696c652e6f70),sn(),family 0,flags 1024
02-11 13:41:23.343: D/libc(26293): [NET] getaddrinfo-, 1
02-11 13:41:23.343: D/libc(26293): [NET] getaddrinfo_proxy+
02-11 13:41:23.353: D/libc(26293): [NET] getaddrinfo_proxy-, success
02-11 13:41:23.353: I/global(26293): call createSocket() return a new socket.
02-11 13:41:23.353: D/libc(26293): [NET] getaddrinfo+,hn 14(0x3139322e313633),sn(),family 0,flags 4
02-11 13:41:23.353: D/libc(26293): [NET] getaddrinfo-, SUCCESS
02-11 13:41:23.453: W/org.osmdroid.tileprovider.modules.MapTileDownloader(26293): Problem downloading MapTile: /3/3/3 HTTP response: HTTP/1.1 403 Forbidden
MyItemizedOverlay

public class MyItemizedOverlay extends ItemizedOverlay<OverlayItem> {

 private ArrayList<OverlayItem> overlayItemList = new ArrayList<OverlayItem>();

 public MyItemizedOverlay(Drawable pDefaultMarker,
   ResourceProxy pResourceProxy) {
  super(pDefaultMarker, pResourceProxy);
  // TODO Auto-generated constructor stub
 }

 public void addItem(GeoPoint p, String title, String snippet){
  OverlayItem newItem = new OverlayItem(title, snippet, p);
  overlayItemList.add(newItem);
  populate(); 
 }

 @Override
 public boolean onSnapToItem(int arg0, int arg1, Point arg2, IMapView arg3) {
  // TODO Auto-generated method stub
  return false;
 }

 @Override
 protected OverlayItem createItem(int arg0) {
  // TODO Auto-generated method stub
  return overlayItemList.get(arg0);
 }

 @Override
 public int size() {
  // TODO Auto-generated method stub
  return overlayItemList.size();
 }

}

你的logcat怎么说?张贴日志你的标题很模糊。可能是“谷歌地图不渲染”之类的。我还以为你在谈论数据结构呢。
/3/3/3http响应:HTTP/1.1403禁止
请按照下面的说明进行操作。不要为osmdroid jar的修补程序操心。请下载4.1版。这具有内置的用户代理更正。