The activity layout is a bit complex... it's a fragment activity, the bottom fragment ('bottomBarFragmentPlaceholder') is the bottomAppBar where the FAB is placed in the middle.
The activity layout is as follows:
<?xml version="1.0" encoding="utf-8"?><!-- practice_activity.xml -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignTop="@id/progressBarTimeText"
android:layout_alignBottom="@id/progressBarTimeText"
android:scaleY="6" />
<TextView
android:id="@+id/progressBarTimeText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="#00000000"
android:gravity="center" />
</RelativeLayout>
<androidx.viewpager.widget.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<FrameLayout
android:id="@+id/bottomBarFragmentPlaceholder"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</FrameLayout>
Then the BottomAppBar layout is as follows:
<?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"
android:id="@+id/bottomBarLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="false">
<com.google.android.material.bottomappbar.BottomAppBar
android:id="@+id/bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@color/primaryLightColor"
android:backgroundTint="@color/primaryLightColor"
app:fabAlignmentMode="center"
app:menu="@drawable/ic_action_overflow"
app:navigationIcon="@drawable/ic_menu_24"
app:popupTheme="@style/ThemeOverlay.MaterialComponents.Dark"
app:theme="@style/ThemeOverlay.MaterialComponents.ActionBar" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/baseline_publish_black_24dp"
app:layout_anchor="@id/bar" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
Why is my FAB being pushed down instead of fitting into the cradle?
Any help would be very much appreciated.
thanks, GBa.