public class AMapNaviView
extends FrameLayout
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
CAR_UP_MODE
0-车头向上模式
0-Car heading up mode |
static int |
NORTH_UP_MODE
1-正北向上模式,步行和骑行导航如果打开了sensor,此模式将无效
1-North up mode, this mode will be invalid if sensor is turned on for walking and cycling navigation. |
| 构造器和说明 |
|---|
AMapNaviView(Context context,
AMapNaviViewOptions options)
根据给定的参数构造一个导航视图类对象
Construct a navigation view class object with the given parameters. |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
displayOverview()
已过时。
请使用
AMapNaviView.setShowMode(int)Please use AMapNaviView.setShowMode(int) |
double |
getAnchorX()
获取当前锁车态下,自车位置锁定在屏幕x轴的位置比率,范围:0-1,0代表最左侧,1代表最右侧
Get the position ratio of the vehicle position locked on the x-axis of the screen under the current vehicle lock state, range: 0-1, 0 represents the leftmost, 1 represents the rightmost |
double |
getAnchorY()
获取当前锁车态下,自车位置锁定在屏幕y轴的位置比率,范围:0-1,0代表最顶端,1代表最底部
Get the position ratio of the vehicle position locked on the y-axis of the screen under the current vehicle lock state, range: 0-1, 0 represents the topmost, 1 represents the bottommost |
int |
getLockTilt()
已过时。
请使用
AMapNaviViewOptions.getTilt()Please use AMapNaviViewOptions.getTilt() |
int |
getLockZoom()
已过时。
请使用
AMapNaviViewOptions.getZoom()Please use AMapNaviViewOptions.getZoom() |
com.amap.api.maps.AMap |
getMap()
获取地图控制类
Get map control class |
int |
getNaviMode()
获取导航模式
Get navigation mode |
AMapNaviViewOptions |
getViewOptions()
返回导航自定义视图的属性配置对象
Return the property configuration object of the navigation custom view. |
boolean |
isAutoChangeZoom()
已过时。
|
boolean |
isOrientationLandscape()
返回当前屏幕的横竖屏状态
Return the current screen orientation status |
boolean |
isRouteOverviewNow()
是否是路线全览模式
Whether it is route overview mode |
boolean |
isShowRoadEnlarge()
当前是否正在显示路口放大图
Whether currently displaying intersection enlargement map |
boolean |
isTrafficLine()
已过时。
|
boolean |
onBackPressed()
与Activity.onBackPressed同步。
|
void |
onCreate(Bundle bundle)
与Activity onCreate同步
Synchronize with Activity onCreate |
void |
onCreate(Bundle bundle,
Activity activity,
AmapPageType pageType)
与Activity onCreate同步
使用这个方法可以通过pageType指定启动的页面类型
|
void |
onDestroy()
与Activity onDestroy同步
Synchronize with Activity onDestroy. |
void |
onPause()
与Activity onPause同步
Synchronize with Activity onPause |
void |
onResume()
与Activity onResume同步
Synchronize with Activity onResume |
void |
onSaveInstanceState(Bundle paramBundle)
与Activity onSaveInstanceState同步
Synchronize with Activity onSaveInstanceState |
void |
recoverLockMode()
已过时。
请使用
AMapNaviView.setShowMode(int)Please use AMapNaviView.setShowMode(int) |
void |
reInit(Bundle bundle)
重新初始化导航自定义导航视图
Reinitialize the custom navigation view. |
void |
setAMapNaviViewListener(AMapNaviViewListener aMapNaviSettingListener)
设置自定义导航界面的事件回调监听
Set event callback listener for custom navigation interface |
void |
setCarOverlayVisible(boolean isVisible)
设置是否隐藏自定义导航view上的车标,包括自车、罗盘、牵引线
Set whether to hide the vehicle icon on the custom navigation view, including the vehicle, compass, and traction line |
boolean |
setCommonOverlayData(java.lang.String data)
设置外部通用点线面数据
Set external general point-line-surface data |
void |
setDriveGuideNaviAnimation(boolean isNaviAnimation)
设置驾车导航动画开关,包括:转场动画和导航态动画
Configure driving navigation animation toggles, including transition animations and navigation mode animations. |
void |
setLazyDirectionView(DirectionView lazyDirectionView)
设置自定义的指南针视图
Set custom compass view |
void |
setLazyDriveWayView(DriveWayView lazyDriveWayView)
设置自定义的车道线视图
Set custom lane line view |
void |
setLazyNextTurnTipView(NextTurnTipView lazyNextTurnTipView)
设置自定义的转向图标
Set custom turn icon |
void |
setLazyOverviewButtonView(OverviewButtonView lazyOverviewButtonView)
设置用户自定义的全览按钮
Set user-defined overview button |
void |
setLazyTrafficButtonView(TrafficButtonView lazyTrafficButtonView)
设置自定义的路况按钮视图
Set custom traffic condition button view |
void |
setLazyTrafficProgressBarView(TrafficProgressBar lazyTrafficProgressBarView)
设置用户自定义的导航光柱条View
Set user-defined navigation light column bar View. |
void |
setLazyZoomButtonView(ZoomButtonView zoomButtonView)
设置自定义的地图缩放按钮
Set custom map zoom button |
void |
setLazyZoomInIntersectionView(ZoomInIntersectionView zoomInIntersectionView)
设置自定义的路口放大图
Set custom intersection enlargement map |
void |
setLockTilt(int lockTilt)
已过时。
请使用
AMapNaviViewOptions.setTilt(int)Please use AMapNaviViewOptions.setTilt(int) |
void |
setLockZoom(int lockZoom)
已过时。
请使用
AMapNaviViewOptions.setZoom(int)Please use AMapNaviViewOptions.setZoom(int) |
void |
setNaviMode(int mode)
已过时。
|
void |
setOnCameraChangeListener(com.amap.api.maps.AMap.OnCameraChangeListener cameraChangeListener)
设置自定义导航view中地图的视角变化事件监听
Set map view change event listener in custom navigation view |
void |
setOnMapLoadedListener(com.amap.api.maps.AMap.OnMapLoadedListener loadListener)
设置自定义导航view中地图的加载完成事件监听
Set map loading completion event listener in custom navigation view |
void |
setOnMapTouchListener(com.amap.api.maps.AMap.OnMapTouchListener mapTouchListener)
设置自定义导航view中地图的点击事件监听
Set map click event listener in custom navigation view |
void |
setOnMarkerClickListener(com.amap.api.maps.AMap.OnMarkerClickListener listener)
设置marker点击事件
Set marker click event |
void |
setOnPolylineClickListener(com.amap.api.maps.AMap.OnPolylineClickListener listener)
设置polyline点击事件
Set polyline click event |
void |
setRouteMarkerVisible(boolean showStartEndVia,
boolean showFootFerry,
boolean showForbidden)
已过时。
|
void |
setRouteMarkerVisible(boolean showStartEndVia,
boolean showFootFerry,
boolean showForbidden,
boolean showRouteStartIcon,
boolean showRouteEndIcon)
是否显示 起终途点\步行轮渡扎点\禁行限行封路icon\路线起点icon\路线终点icon
Whether to display start/end/waypoint\walking ferry waypoint\prohibition/restriction/road closure icon\route start icon\route end icon |
void |
setShowDriveCongestion(boolean showDriveCongestion)
是否显示拥堵气泡
Whether to display congestion bubble |
void |
setShowMode(int showMode)
设置导航页面显示模式
Set navigation page display mode |
void |
setShowTrafficLightView(boolean showTrafficLightView)
是否显示红绿灯倒计时气泡
Whether to display traffic light countdown bubble |
void |
setTMCRouteColor(int defaultColor,
int smoothColor,
int slowColor,
int jamColor,
int seriousJamColor,
int verysmoothColor)
设置光柱图的路口颜色
Set the intersection color of the light column chart |
void |
setTMCRouteLayout(int left,
int top,
int width,
int height)
设置光柱图的位置
Set the position of the light column chart |
void |
setTrafficLightsVisible(boolean isVisible)
设置是否显示路线上的交通信号灯
Set whether to display traffic lights on the route |
void |
setTrafficLine(boolean isTrafficEnable)
|
void |
setViewOptions(AMapNaviViewOptions options)
设置导航自定义视图界面的属性配置对象,用于控制导航地图的仰角,是否展示车道信息,是否显示路况放大图等属性
Set the property configuration object of the navigation custom view interface, used to control properties such as map tilt angle, whether to display lane information, whether to display traffic condition enlargement map, etc. |
void |
zoomIn()
扩大一级当前地图缩放级别
Zoom in one level of the current map zoom level |
void |
zoomOut()
缩小一级当前地图缩放级别
Zoom out one level of the current map zoom level |
public static final int CAR_UP_MODE
public static final int NORTH_UP_MODE
public AMapNaviView(Context context,
AMapNaviViewOptions options)
context - 指定的Context对象。options - 指定的视图属性配置对象。public void reInit(Bundle bundle)
当使用AMapNavi.destroy()销毁了导航,或使用AMap.clear()清空了地图,需要调用此接口重新初始化导航自定义视图。
When navigation is destroyed using AMapNavi.destroy() or the map is cleared using AMap.clear(), this interface needs to be called to reinitialize the custom navigation view.
public boolean onBackPressed()
public double getAnchorX()
public double getAnchorY()
public int getLockZoom()
AMapNaviViewOptions.getZoom()AMapNaviViewOptions.getZoom()public void setLockZoom(int lockZoom)
AMapNaviViewOptions.setZoom(int)AMapNaviViewOptions.setZoom(int)lockZoom - 锁车缩放级别public int getLockTilt()
AMapNaviViewOptions.getTilt()AMapNaviViewOptions.getTilt()public void setLockTilt(int lockTilt)
AMapNaviViewOptions.setTilt(int)AMapNaviViewOptions.setTilt(int)lockTilt - 地图倾斜角度public int getNaviMode()
public void setNaviMode(int mode)
AMapNaviViewOptions.setNaviMode(int)AMapNaviViewOptions.setNaviMode(int)mode - 导航模式 0-CAR_UP_MODE 1-NORTH_UP_MODEpublic boolean isAutoChangeZoom()
AMapNaviViewOptions.isAutoChangeZoom()AMapNaviViewOptions.isAutoChangeZoom()public AMapNaviViewOptions getViewOptions()
public void setViewOptions(AMapNaviViewOptions options)
options - 指定的导航视图属性配置对象public com.amap.api.maps.AMap getMap()
public final void onCreate(Bundle bundle)
bundle - public final void onCreate(Bundle bundle,
Activity activity,
AmapPageType pageType)
bundle - activity - 启动这个view的Activity, 可以传nullpageType - 需要启动的页面类型。默认值:AmapPageType.NAVI导航界面。AmapPageType.ROUTE 显示算路界面, 但需要展示算路界面的时候,使用这个值,使用这个值的时候,建议外部不要使用导航进行算路AmapPageType.NAVI 显示导航界面, 当在启动界面的时候,已经进行算路了,建议使用这个值public final void onResume()
public final void onPause()
public final void onDestroy()
public final void onSaveInstanceState(Bundle paramBundle)
paramBundle - public void displayOverview()
AMapNaviView.setShowMode(int)AMapNaviView.setShowMode(int)public void recoverLockMode()
AMapNaviView.setShowMode(int)AMapNaviView.setShowMode(int)public void setShowMode(int showMode)
showMode - 1-锁车态 2-全览态 3-普通态public boolean isTrafficLine()
AMapNaviViewOptions.isTrafficLine()AMapNaviViewOptions.isTrafficLine()public void setTrafficLine(boolean isTrafficEnable)
AMapNaviViewOptions.setTrafficLine(boolean)AMapNaviViewOptions.setTrafficLine(boolean)isTrafficEnable - 实时路况状态public void setAMapNaviViewListener(AMapNaviViewListener aMapNaviSettingListener)
aMapNaviSettingListener - 界面事件回调监听器public boolean isShowRoadEnlarge()
public boolean isOrientationLandscape()
public void setLazyDriveWayView(DriveWayView lazyDriveWayView)
lazyDriveWayView - public void setLazyZoomInIntersectionView(ZoomInIntersectionView zoomInIntersectionView)
zoomInIntersectionView - public void setLazyDirectionView(DirectionView lazyDirectionView)
lazyDirectionView - public void setLazyTrafficButtonView(TrafficButtonView lazyTrafficButtonView)
lazyTrafficButtonView - public void setLazyNextTurnTipView(NextTurnTipView lazyNextTurnTipView)
lazyNextTurnTipView - public void setLazyZoomButtonView(ZoomButtonView zoomButtonView)
zoomButtonView - public void setLazyOverviewButtonView(OverviewButtonView lazyOverviewButtonView)
lazyOverviewButtonView - public void setLazyTrafficProgressBarView(TrafficProgressBar lazyTrafficProgressBarView)
设置自定义的光柱条view,只需要设置位置和宽、高即可,颜色车标等元素,导航SDK内部会帮助进行更新操作。
To set a custom light column bar view, just set the position, width, and height. The navigation SDK will help update elements such as color and vehicle icons internally.
lazyTrafficProgressBarView - public void zoomIn()
public void zoomOut()
public boolean isRouteOverviewNow()
public void setOnMapLoadedListener(com.amap.api.maps.AMap.OnMapLoadedListener loadListener)
loadListener - OnMapLoadedListener监听public void setOnCameraChangeListener(com.amap.api.maps.AMap.OnCameraChangeListener cameraChangeListener)
cameraChangeListener - OnCameraChangeListener监听public void setOnMapTouchListener(com.amap.api.maps.AMap.OnMapTouchListener mapTouchListener)
mapTouchListener - OnMapTouchListener监听public void setCarOverlayVisible(boolean isVisible)
isVisible - true-显示 false-不显示, 默认为显示public void setTrafficLightsVisible(boolean isVisible)
isVisible - true 显示 false 不显示 默认为显示@Deprecated
public void setRouteMarkerVisible(boolean showStartEndVia,
boolean showFootFerry,
boolean showForbidden)
showStartEndVia - 是否显示起终途点showFootFerry - 是否显示步行轮渡扎点showForbidden - 是否显示禁行限行图标public void setRouteMarkerVisible(boolean showStartEndVia,
boolean showFootFerry,
boolean showForbidden,
boolean showRouteStartIcon,
boolean showRouteEndIcon)
showStartEndVia - 是否显示起终途点showFootFerry - 是否显示步行轮渡扎点showForbidden - 是否显示禁行限行图标showRouteStartIcon - 是否显示路线期起点IconshowRouteEndIcon - 是否显示路线期终点Iconpublic void setOnMarkerClickListener(com.amap.api.maps.AMap.OnMarkerClickListener listener)
listener - public void setOnPolylineClickListener(com.amap.api.maps.AMap.OnPolylineClickListener listener)
listener - public void setTMCRouteLayout(int left,
int top,
int width,
int height)
left - top - width - height - public void setTMCRouteColor(int defaultColor,
int smoothColor,
int slowColor,
int jamColor,
int seriousJamColor,
int verysmoothColor)
defaultColor - 交通状况默认smoothColor - 交通状况情况良好slowColor - 交通状况迟缓jamColor - 交通状况拥堵seriousJamColor - 交通状况严重拥堵verysmoothColor - 交通状况情况非常通畅public boolean setCommonOverlayData(java.lang.String data)
data - public void setShowDriveCongestion(boolean showDriveCongestion)
showDriveCongestion - public void setShowTrafficLightView(boolean showTrafficLightView)
showTrafficLightView - public void setDriveGuideNaviAnimation(boolean isNaviAnimation)
isNaviAnimation -