Reputation: 707
I have a FAB in my layout that is anchored to the BottomAppBar. On certain screens, I want to display the FAB (and the cutout), on other I want it gone.
this is my layout containing the FAB and BottomAppBar.
this is my BaseFragment, where I handle whether or not the FAB should be visible.
My app is built in a way, where the fab isn't visible on the first screen.
When I use View.GONE for my visibility, the fab and cutout are correct on screens WITH a fab, but on screens WITHOUT a fab, the cutout remains.
When I use View.INVISIBLE for my visibility, the fab is correct but the cutout doesn't exist on screens WITH a fab, but on screens without a fab, both are correct.
Upvotes: 0
Views: 237
Reputation: 363895
With a BottomAppBar
and a FloatingActionButton
just use:
fab.hide()
Upvotes: 2