Change the location of MyLocationButton in GoogleMaps
How do I move the Мое местоположение
button from the standard location to ActionBar
to GoogleMaps v2
?
1
1 answers
Well first of all the Action Bar is now deprecated! Stay on trend and use the toolbar! Toolbar is supported in Android OS since 2.2
Here is a good example for you https://examples.javacodegeeks.com/android/android-toolbar-example/
Secondly, you will have to implement your own button with location detection.
Here is one of the options for implementing the button - determining the location:
private LatLng fromPosition;
FAB = (FloatingActionButton) findViewById(R.id.imageButton);
FAB.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
cameraFromPosition();
}
});
private void cameraFromPosition() {
CameraPosition cameraPosition = new CameraPosition.Builder()
.target(fromPosition)
.zoom(17)
.bearing(180)
.tilt(80)
.build();
map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}
What is FAB and how to work with it: http://www.androidhive.info/2015/12/android-material-design-floating-action-button/
1
Author: iFr0z, 2016-03-21 09:54:45