Search code examples
androidandroid-activitymaps

Place button in the bottom of maps activity


I have a button in the upper left corner, i need another button and i want it to be where is the "google" logo, in the lower left corner. This is what the activity looks like. enter image description here

And this is the code, i want buttonChatGlobal to be in the lower left corner

<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapsActivity" >
    <Button
        android:id="@+id/buttonAcercar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#359c5e"
        android:layout_alignParentTop="true"
        android:layout_alignParentEnd="true"
        android:padding="8dp"
        android:layout_margin="5dp"
        android:text="Acercar/Alejar"
        android:textColor="#ffffff" />

    <Button
        android:id="@+id/buttonChatGlobal"
        android:layout_width="wrap_content"
        android:gravity="bottom"
        android:layout_height="wrap_content"
        android:background="#359c5e"
        android:padding="8dp"
        android:layout_margin="5dp"
        android:text="ChatGlobal"
        android:textColor="#ffffff" />




</fragment>

Solution

  • Just replace this code below with your button you want

             <Button
                android:id="@+id/buttonChatGlobal"
                android:layout_width="wrap_content"
                android:gravity="bottom"
                android:layout_height="wrap_content"
                android:background="#359c5e"
                android:padding="8dp"
                android:layout_margin="5dp"
                android:text="ChatGlobal"
                android:gravity="bottom|left"
                android:textColor="#ffffff" />