How to make a View overlap?

0

I have this XML :

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapFragment">

<include
    android:id="@+id/include_toolbar_map"
    layout="@layout/toolbar_localizacao"
    />


<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_localizacao_24dp"
    android:theme="@style/FABTheme"
    android:layout_alignParentBottom="true"
    android:layout_alignParentEnd="true"
    android:layout_marginBottom="13dp"
    android:layout_marginEnd="13dp"
    />

<com.github.clans.fab.FloatingActionMenu
    android:id="@+id/fab_menu"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignEnd="@+id/fab"
    android:layout_alignParentBottom="true"
    android:layout_marginBottom="73dp">

</com.github.clans.fab.FloatingActionMenu>


<!-- TODO: Update blank fragment layout -->
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/map_fragment"
    android:name="com.google.android.gms.maps.SupportMapFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentStart="true"
    android:layout_alignParentTop="true"
    tools:context=".MapActivity" />

But it turns out that fab_menu is behind Fragment (as the image illustrates), and my goal is to get it ahead of Fragment .

    
asked by anonymous 05.06.2018 / 11:14

1 answer

0

You can use FrameLayout to make one view overlap another. Here's an example of my video player:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent">

    <FrameLayout
        android:id="@+id/framePlayer"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <SurfaceView
            android:id="@+id/svPlayer"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

    </FrameLayout>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.v7.widget.Toolbar
            android:id="@+id/tbPlayer"
            android:background="@drawable/drop_shadow"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <ProgressBar
            android:id="@+id/playerSpinner"
            style="?android:progressBarStyleLarge"
            android:indeterminate="true"
            android:layout_gravity="center"
            android:visibility="gone"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </FrameLayout>

</FrameLayout>
    
05.06.2018 / 13:35