I'm trying to show snackbar without context but it gets hidden behind the system UI buttons, So what to do for the same?
Code:
Snackbar.make(this.vie, message, Snackbar.LENGTH_SHORT)
.setBackgroundTint(resources.getColor(R.color.blue, null)).show()
Thanks in advance.
Is your window set to no limits(maybe for supporting transparent nav bar)? If so, removing that piece of code can be a fix for now, I guess.
For example you can use setAnchorView
method where you will define views according to which you would like to align your snackBar. Some sample below:
Snackbar snackbar = Snackbar.make(view,"Snackbar over BottomNav",Snackbar.LENGTH_INDEFINITE);
snackbar.setAnchorView(bottomNavigationView);
snackbar.show();
and also setLayoutParams
can be useful:
Snackbar snack = Snackbar.make(findViewById(R.id.coordinatorLayout),
"Your message", Snackbar.LENGTH_LONG);
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams)
snack.getView().getLayoutParams();
params.setMargins(leftMargin, topMargin, rightMargin, bottomBar.height);
snack.getView().setLayoutParams(params);
snack.show();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.