愿你出走半生,归来仍是少年!
通过创建这个实例并添加到MapView中后,会在地图上出现一个随着缩放等级变换的比例尺控件。
通过其方法可进行位置、单位等等参数设置。
Modifier and TypeMethodDescriptionvoidsetMinZoom(double zoom)Sets the minimum zoom level for the scale bar to be drawn.ScaleBarOverlay.UnitsOfMeasuregetUnitsOfMeasure()Gets the units of measure to be shown in the scale barvoidsetUnitsOfMeasure(ScaleBarOverlay.UnitsOfMeasure unitsOfMeasure)Sets the units of measure to be shown in the scale barvoidsetAlignBottom(boolean alignBottom)voidsetAlignRight(boolean alignRight)PaintgetBarPaint()Return's the paint used to draw the barvoidsetBarPaint(Paint pBarPaint)Sets the paint for drawing the barPaintgetTextPaint()Returns the paint used to draw the textvoidsetTextPaint(Paint pTextPaint)Sets the paint for drawing the textvoidsetCentred(boolean centred)Flag to draw the bar centered around the set offset coordinates or to the right/bottom of thecoordinates (default)voidsetMaxLength(float pMaxLengthInCm)Sets the maximum bar length.voidsetScaleBarOffset(int x, int y)Sets the scale bar screen offset for the bar.voidsetLineWidth(float width)Sets the bar's line width.voidsetTextSize(float size)Sets the text size.voiddrawLatitudeScale(boolean latitude)Latitudinal / horizontal scale bar flagvoiddrawLongitudeScale(boolean longitude)Longitudinal / vertical scale bar flagvoidsetBackgroundPaint(Paint pBgPaint)Sets the background paint.voidsetEnableAdjustLength(boolean adjustLength)If enabled, the bar will automatically adjust the length to reflect a round number (startingwith 1, 2 or 5).voiddraw(Canvas c, Projection projection)voiddisableScaleBar()voidenableScaleBar()voidonDetach(MapView mapView)Override to perform clean up of resources before shutdown.static StringgetScaleString(Context pContext, String pValue, GeoConstants.UnitOfMeasure pUnitOfMeasure)