Scalebar Plugin
Mappls Scalebar Plugin¶
Introduction¶
Mappls Scalebar Plugin can be used to add a scale bar on map view to determine distance based on zoom level.
Initalize ScaleBarPlugin in onMapReady()
Add the dependency¶
Add below dependency in app level build.gradle file
Kotlin (build.gradle.kts)¶
// When using the BoM, you don't specify versions in Mappls library dependencies
implementation("com.mappls.sdk:scalebar-plugin")
//Or Add Dependency with Version
implementation("com.mappls.sdk:scalebar-plugin:2.0.0")
Groovy (build.gradle)¶
// When using the BoM, you don't specify versions in Mappls library dependencies
implementation 'com.mappls.sdk:scalebar-plugin'
//Or Add Dependency with Version
implementation("com.mappls.sdk:scalebar-plugin:2.0.0")
Implementation¶
Kotlin¶
val scaleBarPlugin = ScaleBarPlugin(mapView, mapplsMap!!)
val scalebarOptions = ScaleBarOptions(this)
.setTextColor(android.R.color.black)
.setTextSize(40f)
.setBarHeight(5f)
scaleBarPlugin.create(scalebarOptions)
Java¶
ScaleBarPlugin scaleBarPlugin = new ScaleBarPlugin(mapView, mapplsMap);
ScaleBarOptions scaleBarOptions = new ScaleBarOptions(this)
.setTextColor(android.R.color.black)
.setTextSize(40f)
.setBarHeight(5f)
scaleBarPlugin.create(scaleBarOptions);
You can use ScaleBarOptions to set the following properties:
setPrimaryColor(Integer): To set primary color of scalebarsetSecondaryColor(Integer): To set secondary color of scalebarsetTextColor(Integer): To set the text color of text in scalebarsetTextSize(float): To set the text size in scalebarsetBarHeight(float): To set the height of scalebarsetBorderWidth(float): To set border width of scalebarsetRefreshInterval(Integer): To set refresh interval of scalebarsetMarginTop(Integer): To set top margin of scalebarsetMarginLeft(Integer): To set left margin of scalebarsetTextBarMargin(float): To set margin between text and scalebarsetMaxWidthRatio(float): To set width ratio of scalebarsetShowTextBorder(Boolean): To show text border or notsetMetricUnit(Boolean): To use metric unitsetTextBorderWidth(float): To set border width of text
For any queries and support, please contact:
Email us at apisupport@mappls.com
Support
Need support? contact us!
@ Copyright 2025 CE Info Systems Ltd. All Rights Reserved.
Terms & Conditions | Privacy Policy | Supplier Sustainability Policy | Health & Safety Policy | Environmental Policy & CSR Report
Customer Care: +91-9999333223
