Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix the Snackbar height and position?

On Android Support Library 24.1.1, the Snackbar was working fine:

before

Then starting on Android Support Library 24.2.0 onwards, the Snackbar started to behave like this:

after

On the library revision history, there is the following statement:

Behavior changes: Snackbar now draws behind the navigation bar if the status bar is translucent.

But the thing is that my app is full screen and it doesn't have the navigation bar or the status bar. How can I fix it?

like image 891
thiagolr Avatar asked Dec 23 '16 11:12

thiagolr


People also ask

How can I increase the height of my snack bar?

setTextSize(24); //increase max lines of text in snackbar. default is 2. sbNoAct. show(); int height = sbView.

How do you set the SnackBar height in flutter?

SnackBar takes a widget as a child. SnackBar takes the height of the child to render. When you pass a container with height 200 it will set the snack bar's height 200. scaffoldKey.

How long is SnackBar Length_long?

So to answer your question the actual duration for the long length is 2750 milliseconds.


1 Answers

It's 2020 and also I don't know if it's related but I got my snackbar having some padding at the bottom when using android 10 gesture navigation. None of the above works for my case. I finally got it fixed with a super simple line:

val snackbar = Snackbar.make(view, message, duration)
snackbar.isGestureInsetBottomIgnored = true // here
snackbar.show()

Hope it helps.

like image 92
Alex Do Avatar answered Oct 05 '22 13:10

Alex Do