How to make bottom sheet above maps activity?

I would like to make my activity like Google Maps.

I have added a bottom sheet but, when I run the application the bottom sheet appeared below the maps while other activities appear above it without any problem.

How to make it appear above the map like this?

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">
        <fragment
            android:id="@+id/map"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            class="com.google.android.gms.maps.SupportMapFragment"
            android:layout_marginBottom="56dp"/>
</RelativeLayout>

<!-- Bottom Sheet Content -->
<include layout="@layout/content_bottom_sheet" android:fitsSystemWindows="true"/>
</android.support.design.widget.CoordinatorLayout>

Upvotes: 0

Views: 1133

Answers (1)

Pratik Dhingani
Pratik Dhingani

Reputation: 91

Use below code

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    >



    <fragment
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.MapFragment"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="50dp" />



    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="20dp"
        android:gravity="bottom|center_horizontal"
        android:orientation="horizontal"
        android:layout_gravity="bottom">

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/texi_white"
            android:gravity="center"
            android:text="Map"
            android:textAllCaps="false"
            android:textColor="@android:color/darker_gray"
            android:textStyle="bold" />
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/food_white"
            android:gravity="center"
            android:text="List"
            android:textAllCaps="false"
            android:textColor="@android:color/darker_gray"
            android:textStyle="bold" />

    </LinearLayout>

</FrameLayout>

`

Upvotes: 1

Related Questions