I cant position my FAB. It should be bottom right, but on top of the BottonNavigationView.
1) Can i achieve this without RelativeLayout inside coordinateLayout?
A quick search to FloatingActionButton.Behavior
tells us the following thing.
@Override
public void onAttachedToLayoutParams(@NonNull CoordinatorLayout.LayoutParams lp) {
if (lp.dodgeInsetEdges == Gravity.NO_GRAVITY) {
// If the developer hasn't set dodgeInsetEdges, lets set it to BOTTOM so that
// we dodge any Snackbars
lp.dodgeInsetEdges = Gravity.BOTTOM;
}
}
Since BottomNavigationView
also resides at the bottom of the layout. Add following element to your BottomNavigationView
and CoordinatorLayout
will handle the inset and dodging for you automatically.
app:layout_insetEdge="bottom"