How to add Google material icon "my location" on google map V2 in android? -


i trying show maps in android using api v2.

i want google material icon "my location" on map. but, whenever try add in layout, not reflect in output.

i able maps without icon. need icon integrate map.

when write imagebutton code outside fragment tag, icon displays in preview pane, not inside it.

where should put imagebutton code?

code mylayout.xml:

<relativelayout     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical">      <fragment         android:id="@+id/map"         android:name="com.google.android.gms.maps.supportmapfragment"         android:layout_width="match_parent"         android:layout_height="match_parent">     </fragment>      <imagebutton         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:id="@+id/ic_gps"         android:layout_alignparenttop="true"         android:layout_alignparentright="true"         android:src="@drawable/ic_my_location_black_18dp" /> </relativelayout> 

link:- https://design.google.com/icons/#ic_my_location

get map object (mmap) , call setmylocationenabled(boolean) on it.

mmap.setmylocationenabled(true);

this add default image button initiates 'find location' action.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -