I am writing an Android application that includes a map using the Google Maps API.
I load custom map tiles using my com.google.android.gms.maps.model.UrlTileProvider native extension.
I have two sets of map plates: one is for screens with a higher density and one is for screens with a lower density. A set of tiles with a higher image density has larger text, etc. Both sets use a 256x256 pixel map tile size.
I switch between the two sets depending on the screen density obtained from:
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); Float density = displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT;
So far so good.
The corresponding set of map tiles is displayed depending on the density, as it should be.
However, on higher density devices (where many pixels are considered to be one logical density independent pixel (DiP / DP)), each pixel of the map pixel is scaled to correspond to one DiP / DP device. In other words, a higher density device differs in what the cards will look like when rendering.
I played with the width / height of the UrlTileProvider constructor for a UrlTileProvider , but they don't seem to have any effect.
And I can not find any parameters in the Google Maps API to help me solve my problem.
I did not find a solution on stackoverflow or other sites.
Does anyone know how to solve my problem?
source share