所以,你想达到白种人的目标
Toolbar
具有
BottomAppBar
为此,添加
AppBarLayout
工具栏
在里面
CoordinatorLayout
,放置
底部AppBar
和
FloatingActionButton
并设置
app:layout_anchor
的属性
浮动操作按钮
引用的id
具体如下:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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=".MainActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/yourwhitebackground"
app:elevation="0dp">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/yourwhitebackground"
app:layout_collapseMode="pin"
app:layout_scrollFlags="scroll|enterAlways"
/>
</android.support.design.widget.AppBarLayout>
<android.support.design.bottomappbar.BottomAppBar
android:id="@+id/bottom_appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:fabAttached="true"
app:backgroundTint="@color/colorPrimary"
app:fabCradleVerticalOffset="12dp">
</android.support.design.bottomappbar.BottomAppBar>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:src="@drawable/ic_add_white_24dp"
app:layout_anchor="@+id/bottom_appbar"/>
</android.support.design.widget.CoordinatorLayout>
https://medium.com/@lupajz/the-place-for-bottomappbar-31e0db8f70b1
更多细节。
app:elevation
可能不起作用,请尝试以下操作:
https://stackoverflow.com/a/45703684/4409113