繁体   English   中英

如何在地图活动上方创建底页?

[英]How to make bottom sheet above maps activity?

我想使自己的活动像Google Maps一样。

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

如何使其像这样显示在地图上方?

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

使用以下代码

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

`

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM