2015-05-22 87 views
0

我不得不滿足約CityMaps某個位置的問題,如下:位置有關問題Citymaps

1,我已創建延伸FragmentActivity實現接口MapViewReadyListener,LocationSource,LocationListener的一個活動,然後inital的SupportCitymapsMapFragment例如,設置一些參數如下:

fragment = (SupportCitymapsMapFragment)getSupportFragmentManager().findFragmentById(R.id.map); 
    mLocationManager = (LocationManager)context.getSystemService(Context.LOCATION_SERVICE); 
    mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this); 
    mParams = new LocationParams(1, 1000, 1000); 


    if (fragment != null) { 
     fragment.getMapView().startUpdatingLocation(); 
     fragment.getMapView().getBusinessLayer().setVisible(false); 
     fragment.getMapView().getRegionLayer().setVisible(false); 
     fragment.setMapViewReadyListener(MainActivity.this); 
     fragment.getMapView().setLocationSource(this); 
    } 
在方法

onLocationChanged(地點位置),I這樣設置地圖位置:

CitymapsMapView map = fragment.getMapView(); 
    map.getBusinessLayer().setVisible(false); 
    map.getRegionLayer().setVisible(false); 
    LonLat position = new LonLat(location.getLongitude(), location.getLatitude()); 
    int zoom = 15; 
    float orientation = 45.0f; 
    float tilt = 15.0f; 
    MapPosition mapPosition = new MapPosition(position, zoom, orientation, tilt); 
    map.setMapPosition(mapPosition); 

但是,當我打開GPS和我的應用程序時,我發現在地圖上顯示的位置不是我當前的位置,而是最後一個地方,更重要的是,地圖有時甚至沒有加載出我的網絡,爲什麼?

2,我嘗試以其他方式獲取經度/緯度座標,並以傳統方式創建MapView。當我去一個新地方並打開我的應用程序時,我發現箭頭仍然位於最後一個地方,但敬酒了給我說說我目前的職位correctly.After技巧約一個半小時,再打開應用程序,這是剛剛好,爲什麼會這樣呢?

3,我有加標籤,標記,是否我可以定製標籤的字體樣式?

回答

0

我是Citymaps SDK的開發人員,我會盡我所能來回答你的問題。

1)看起來你誤解了LocationSource界面的工作原理。請查看CitymapsLocationSource.java以查看示例實現。

2)如果您使用的是自定義位置源,它是由你來讓地圖知道什麼時候位置已經改變

3)這時,該API不會暴露。如果您希望使用自定義字體的標記標籤,我建議將自定義ViewGroup呈現爲Bitmap,並將該Bitmap設置爲標記圖像。