2015-04-23 16 views
0

我有一些需要使用OSMPublicTransport tilesource的應用程序有一些麻煩。Osmdroid渲染不像這樣 - TileSource PublicTransport

點擊here看到奇怪 MapView。所以,爲什麼是我的應用程序中這個醜陋的東西? 其他tilesource像魅力工作。

我不知道爲什麼它顯示我這樣的mapview。 我在等待一個結果,如官方website

這是我XML文件

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/parent_container" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
    <org.osmdroid.views.MapView 
     android:id="@+id/mapview" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     tilesource="OSMPublicTransport" /> 
</RelativeLayout> 

在這裏,我怎麼申報我看來

protected override void OnCreate(Bundle bundle) 
     { 
      base.OnCreate(bundle); 

      SetContentView(Resource.Layout.Main); 
      mapView = FindViewById<MapView> (Resource.Id.mapview); 

      mapView.SetTileSource (TileSourceFactory.PublicTransport); 

      mapView.SetBuiltInZoomControls (true); 
      mapView.SetMultiTouchControls (true); 
     } 

在前進,謝謝!

回答

0

OSMPublicTransport圖塊是覆蓋圖塊。它們旨在顯示在現有圖像的頂部。因此,請使用常規瓷磚來源,然後爲疊加圖像添加新的TilesOverlay:

// Add tiles layer 
MapTileProviderBasic provider = new MapTileProviderBasic(getApplicationContext()); 
provider.setTileSource(TileSourceFactory.PUBLIC_TRANSPORT); 
TilesOverlay tilesOverlay = new TilesOverlay(provider, this.getBaseContext()); 
mapView.getOverlays().add(tilesOverlay); 
+0

謝謝,它的工作原理非常魅力! – Nawako