为什么在底部栏后面有浮动操作按钮 [英] Why Floating action button Behind the BottomBar

查看:88
本文介绍了为什么在底部栏后面有浮动操作按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望浮动动作按钮位于BottomBar和正面的中间,而不是背面的中间,请指导我解决此问题.我的层代码如下...

I want the Floating Action Button in the middle of the BottomBar and the front, not on the back, please guide me to solve this problem My layer codes are as follows...

<RelativeLayout 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:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent">

<FrameLayout
    android:id="@+id/content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentStart="true"
    android:layout_alignParentTop="true"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"/>


<android.support.design.widget.FloatingActionButton
    android:id="@+id/floatingActionButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="31dp"
    android:clickable="true"
    android:elevation="0dp"
    app:backgroundTint="@color/colorPrimaryDark"
    app:borderWidth="0dp"
    app:elevation="8dp"
    app:fabSize="normal"
    app:layout_behavior="helpers."
    app:srcCompat="@drawable/ic_add_black_24dp"
    tools:ignore="VectorDrawableCompat" />

<com.roughike.bottombar.BottomBar
    android:id="@+id/bottomBar"
    android:layout_width="match_parent"
    android:layout_height="60dp"
    android:layout_alignParentBottom="true"
    app:bb_tabXmlResource="@xml/bottombar_tabs" />

推荐答案

相对布局在视图上方排列视图,因此视图按您在xml中声明的顺序排列

因此,请更改视图顺序.

So change your order of your view.

<RelativeLayout 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:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent">

<FrameLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

<com.roughike.bottombar.BottomBar
android:id="@+id/bottomBar"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
app:bb_tabXmlResource="@xml/bottombar_tabs" />

<android.support.design.widget.FloatingActionButton
android:id="@+id/floatingActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="31dp"
android:clickable="true"
android:elevation="0dp"
app:backgroundTint="@color/colorPrimaryDark"
app:borderWidth="0dp"
app:elevation="8dp"
app:fabSize="normal"
app:layout_behavior="helpers."
app:srcCompat="@drawable/ic_add_black_24dp"
tools:ignore="VectorDrawableCompat" />

希望它会有所帮助..!

Hope it helps..!

已编辑

 <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="60dp"
    android:layout_alignParentBottom="true">
    <com.roughike.bottombar.BottomBar
        android:id="@+id/bottomBar_"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        app:bb_tabXmlResource="@xml/bottom_tabs" />
</LinearLayout>

这篇关于为什么在底部栏后面有浮动操作按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆