How to get the location of a centered place on a map like uber android app
2 answers
I'm not sure which language you are using, so there is a javascript solution here. try to create a latlng variable and use that variable to position the marker and define the center. You could do something like this
var markerLatlng = new google.maps.LatLng ("your coords here");
var mapOptions = {
zoom :5,
center: markerLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var marker = new google.maps.Marker({
position: markerLatlng,
map: map,
animation: google.maps.Animation.DROP,
title: "your title here",
});
Hope this helps.
0
source to share
You can use CurrentCenterPositionMap
First, import the lib:
compile 'br.com.simplepass:mapfragmentwrapper:0.8.0'
Then all you have to do is put the MapFragmentWrapper xml tag as the container of your map fragment. Like this:
<br.com.simplepass.mapfragmentwrapper.MapFragmentWrapper
android:id="@+id/map_wrapper"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="@+id/main_fragment_map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
</br.com.simplepass.mapfragmentwrapper.MapFragmentWrapper>
See the result:
0
source to share