Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SnackBar from top. Is this possible?

I wanted to provide the SnackBar animation from top, instead of the regular behavior that displays the SnackBar from bottom. Is this easily hackable?

like image 431
Fábio Carballo Avatar asked Jul 27 '15 17:07

Fábio Carballo


People also ask

How do you set a snackbar position?

Snackbars should be placed at the bottom of a UI, in front of app content.

What is the difference between a toast and snackbar?

Snackbars contain a single line of text directly related to the operation performed. They may contain a text action, but no icons. Toasts (Android only) are primarily used for system messaging. They also display at the bottom of the screen, but may not be swiped off-screen.

Is a snackbar a view?

Snackbar in android is a new widget introduced with the Material Design library as a replacement of a Toast. Android Snackbar is light-weight widget and they are used to show messages in the bottom of the application with swiping enabled. Snackbar android widget may contain an optional action button.


2 Answers

it is possible. check this library made by me https://github.com/AndreiD/TSnackBar

basically you add 2 new animations for sliding from top, and change the gravity of the layout. That's all :)

Later Edit: there's a bug going on.... . if anyone wants to spend some time into fixing it we'd all appreciate it :)

like image 167
OWADVL Avatar answered Oct 01 '22 12:10

OWADVL


No it is not possible. The documentation states that

They show a brief message at the bottom of the screen on mobile and lower left on larger devices. Snackbars appear above all other elements on screen and only one can be displayed at a time.

You could use a third part library, like Crouton for instance

like image 30
Blackbelt Avatar answered Oct 01 '22 10:10

Blackbelt