I would like to add a Button on top of my default Googlemap Activity in android studio. I tried this one by changing the XML code of Googlemap fragment like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<fragment
android:id="@+id/location_map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:padding="0dp"
android:paddingBottom="0dp"
android:background="#359c5e"
android:text="@string/go"
android:textColor="#ffffff" />
But I am unable to get Button on my mapfragment. I tried so many ways by writing Button before Fragment and Viceversa in XML file, still facing the same problem.
My requirement is that
- to create a Button on mapfragment .
- when it is clicked it should show some customized markers on it.
How to achieve this task ? Any suggestions are appreciated.