I followed the most voted answer and added app:layout_insetEdge="bottom" in coordinatelayout and bottomnavigationview. This did not work. My Floating button is ABOVE bottomnavigationview and is floating over VIEWPAGER.
if i set it to top center it will float over appbar.
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.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"
android:addStatesFromChildren="true"
tools:context=".MainActivity"
app:layout_insetEdge="bottom">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foreground="@mipmap/ic_banner_foreground">
<androidx.appcompat.widget.Toolbar
android:id="@+id/top_toolbar"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_gravity="center"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="45dp"
android:background="?attr/colorPrimary"
app:tabGravity="fill"
app:tabIndicatorColor="#00FF82"
app:tabMinWidth="97.99dp"
app:tabMode="auto"
app:tabTextColor="#FFFFFF" />
</com.google.android.material.appbar.AppBarLayout>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_toolbar"
android:layout_width="match_parent"
android:layout_height="49dp"
android:layout_gravity="bottom|center"
app:layout_anchorGravity="bottom|center"
android:theme="@style/Theme.MaterialComponents.DayNight.DarkActionBar"
app:backgroundTint="@color/colorPrimary"
app:itemIconTint="@android:color/white"
app:itemTextColor="@android:color/white"
app:layout_insetEdge="bottom"
app:menu="@menu/bottom_bar"/>
<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="582dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<ListView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="582dp" />
</androidx.viewpager.widget.ViewPager>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/post_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_baseline_eco_24"
app:backgroundTint="@color/colorPrimary"
android:layout_gravity="bottom|center"
app:layout_anchorGravity="bottom|center"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>