I just looked around the API for a method in the class com.esri.android.map.MapView for a method for adding a scale bar to the map view. All I see is a getScale() method. Is there an easy way to add a scale bar to the map view that I am missing?
I guess I could make one up from the get scale method and then use a fragment....
As near as I could tell one would have to make up a custom one. We felt like we did not need it that bad. But I must say I was surprised that something was not in the API. One would think this is a basic thing esri would want to put in...... ??
Thank you for the example Kolek, I am looking for a scale that shows like 2 inches = 5 km, so the users know how much area they are looking at.
It seems like I will have to do some custom work to get this working.
We've done something like this in our iOS apps. We figure out the DPI of the device's screen and then create a one-inch long rectangle. Then we hook into the zoom/pan events and update scale text to display "1in = XXXft" (or whatever) based on a geodetic measure of the extent of the rectangle on the map.
It works pretty well.
I have worked on the map scale bar using ArcGIS android SDK 10.2.
Normally there no found the solution for display scale bar what you want.
But I found the example associated with this issue.
You can check this url and apply the sample.
this is not the sample for ArcGIS android SDK, but you can change it in order to the SDK.
if you want to know more details, I could provide my program.