Felipe Souza Felipe Souza - 3 months ago 7
Java Question

How can i display points on map without cut?

I need center 2 point on map, but when i use this code point are displayed cut :

LatLngBounds.Builder builder = new LatLngBounds.Builder();
for (int i=0;i<this.posicoesDispositivos.size();i++) {
builder.include(this.posicoesDispositivos.get(i));
}
LatLngBounds bounds = builder.build();
if (primeiraExecucao) {
mMapa.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0));
primeiraExecucao = false;
}


Image of display of this code:

enter image description here

Answer
CameraUpdateFactory.newLatLngBounds(bounds, 0)

The last parameter that you are passing 0 is padding. You can change the value of padding to get the desired result such as

CameraUpdateFactory.newLatLngBounds(bounds, 20)

In this case 20 pixels will be added on all 4 sizes of bounding box.

Comments