如何在地图活动上面制作底部工作表?

时间:2017-02-27 12:02:53

标签: android

我想像谷歌地图一样开展我的活动。

我添加了一张底页但是,当我运行该应用程序时,底部工作表显示在地图下方,而其他活动显示在其上方没有任何问题。

如何让它显示在地图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>

1 个答案:

答案 0 :(得分:1)

使用以下代码

<?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>

`

相关问题