BottomNavigationView下坐标布局上的java Fab按钮
fab按钮隐藏在BottomNavigationView下,我希望它们位于BottomNavigationView的顶部,我尝试使用约束布局,但这破坏了一些功能。我需要保持协调的布局
这是布局图:
<?xml version="1.0" encoding="utf-8"?>
<安卓x.coordinatorlayout.widget.CoordinatorLayout xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
xmlns:app="http://schemas.安卓.com/apk/res-auto"
xmlns:tools="http://schemas.安卓.com/tools"
安卓:layout_width="match_parent"
安卓:layout_height="match_parent"
tools:context=".MainActivity">
<com.google.安卓.material.appbar.AppBarLayout
安卓:layout_width="match_parent"
安卓:layout_height="wrap_content"
安卓:theme="@style/AppTheme.AppBarOverlay">
<安卓x.appcompat.widget.Toolbar
安卓:id="@+id/toolbar"
安卓:layout_width="match_parent"
安卓:layout_height="?attr/actionBarSize"
安卓:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</com.google.安卓.material.appbar.AppBarLayout>
<include
layout="@layout/content_main"
安卓:background="?attr/colorButtonNormal" />
<com.google.安卓.material.floatingactionbutton.FloatingActionButton
安卓:id="@+id/fab"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:layout_gravity="bottom|end"
安卓:layout_margin="@dimen/fab_margin"
安卓:scaleType="fitXY"
app:backgroundTint="@color/colorPrimary"
app:fabSize="auto"
app:maxImageSize="38dp"
app:srcCompat="@drawable/ic_add_black_24dp"
tools:ignore="VectorDrawableCompat" />
<com.google.安卓.material.floatingactionbutton.FloatingActionButton
安卓:id="@+id/close_voice_fab"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:layout_gravity="bottom|start"
安卓:layout_margin="@dimen/fab_margin"
安卓:onClick="getSpeechInput"
安卓:scaleType="fitXY"
app:backgroundTint="@color/colorPrimary"
app:fabSize="auto"
app:maxImageSize="34dp"
app:srcCompat="@drawable/ic_close_black_24dp"
tools:ignore="VectorDrawableCompat" />
<com.google.安卓.material.floatingactionbutton.FloatingActionButton
安卓:id="@+id/voice_fab"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:layout_gravity="bottom|start"
安卓:layout_margin="@dimen/fab_margin"
安卓:onClick="getSpeechInput"
安卓:scaleType="fitXY"
安卓:tint="@color/colorPrimary"
app:backgroundTint="@color/colorAccent"
app:fabSize="auto"
app:maxImageSize="34dp"
app:srcCompat="@drawable/ic_mic"
tools:ignore="VectorDrawableCompat" />
<com.google.安卓.material.bottomnavigation.BottomNavigationView
安卓:layout_width="match_parent"
安卓:layout_height="wrap_content"
安卓:layout_gravity="bottom"
安卓:background="#D8D8D8"
app:layout_behavior="@string/hide_bottom_view_on_scroll_behavior"/>
</安卓x.coordinatorlayout.widget.CoordinatorLayout>
这就是我得到的:https://imgur.com/a/nTAb0Bk
我该怎么做才能使晶圆厂位于bottomNavigationView的顶部,如果bottomNavigationView隐藏,这些按钮应该位于布局的底部
# 1 楼答案
将高程设置为晶圆厂图标,如下所示: