Reputation: 871
I got an coordinator layout in Activity for showing a snackbar which may ask user to confirm exit when the user pressed back button.
Also I have got a coordinator layout inside a fragment for showing the floating action button in that fragment.
However, the snackbar will covering the floating action button inside the fragment. Isn't it the only way is to keep one coordinator layout? Any other way to keep this structure and the FAB will response to the snackbar showing and move up?
Upvotes: 0
Views: 803
Reputation:
Pass the FloatingActionBar's View into SnackBar.
Sample Code:
SnackBar.make(findViewById(R.id.fab),"Hello StackOverflow",SnackBar.LENGTH_SHORT).show();
Where, id fab
is the id of FloatingActionButton in layout xml.
Upvotes: 1