首页 > 解决方案 > 在片段和导航栏android中添加边距beetwen扩展浮动操作按钮

问题描述

我在片段中有一个 ExtendedFloatingActionButton,我想在按钮之间添加一些空间,这里的导航栏是我当前的代码

扩展浮动操作按钮

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">

.....

<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
    android:id="@+id/check_out"
    android:layout_width="130dp"
    android:layout_height="40dp"
    android:layout_gravity="end|bottom"
    android:layout_marginBottom="?attr/actionBarSize"
    app:backgroundTint="@color/white"
    android:fontFamily="@font/metropolis_bold"
    android:elevation="5dp"
    android:gravity="center"
    android:text="Check out"
    android:textColor="@color/dark_blue" />

 </FrameLayout>

然后是主活动布局内的 NavigationBar

<androidx.constraintlayout.widget.ConstraintLayout 
   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"
   tools:context=".activities.MainActivity"
   android:background="@color/light_grey">
.....

<com.ismaeldivita.chipnavigation.ChipNavigationBar
    android:layout_width="match_parent"
    android:id="@+id/nav_view"
    android:layout_height="?attr/actionBarSize"
    app:layout_constraintBottom_toBottomOf="parent"
    app:cnb_menuResource="@menu/main_menu"
    android:background="@drawable/nav_bar_back"
    android:elevation="6dp"/>

 .....
 </androidx.constraintlayout.widget.ConstraintLayout>

这是一个屏幕截图 在此处输入图像描述

那么如何在那个按钮和导航栏之间添加一些空间

标签: androidfragmentmarginnavigationbarfloating-action-button

解决方案


推荐阅读