本文介绍了以方向单位km/min(而非英里/英尺)显示地图框的导航视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何显示方向为km/minutes
而不是miles/feets
how to Show navigationview
of mapbox
with direction units km/minutes
instead of miles/feets
String awsPoolId = null;
boolean simulateRoute = false;
Log.e("=origin==", "" + origin);
Log.e("=desti==", "" + destination);
// Call this method with Context from within an Activity
NavigationLauncher.startNavigation(GotoPickup.this, origin, destination, awsPoolId, simulateRoute);
推荐答案
您必须设置所需的类型(METRIC).我从Mapbox计算路线(注意语音说明),然后将其传递给NavigationLauncher:
You have to set your desired type (METRIC). I calculate the route from Mapbox (pay attention to voice instructions) and pass it to the NavigationLauncher:
NavigationRoute.builder()
.voiceUnits(DirectionsCriteria.METRIC)
...
.build()
.getRoute(new Callback<DirectionsResponse>() {
// Checkout mapbox tutorials for this part
DirectionsRoute directionsRoute = ...
NavigationLauncherOptions options = NavigationLauncherOptions.builder()
.directionsRoute(directionsRoute)
.unitType(NavigationUnitType.TYPE_METRIC)
.build();
NavigationLauncher.startNavigation(MyActivity.this, options);
}
});
使用com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.13.0正常工作
Works fine with com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.13.0
这篇关于以方向单位km/min(而非英里/英尺)显示地图框的导航视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!