1

In the following picture , there is notification bar which shows "reload videos", I wanted to create something like that for my app. I looked at snack bar examples . But it seems we can't make it on top.

enter image description here

Kushal Bhalaik
  • 3,349
  • 5
  • 23
  • 46

1 Answers1

1

We can make Snackbar to be appear on top Using below code.

Snackbar snack = Snackbar.make(parentLayout, str, Snackbar.LENGTH_LONG);
View view = snack.getView();
FrameLayout.LayoutParams params =(FrameLayout.LayoutParams)view.getLayoutParams();
params.gravity = Gravity.TOP;
view.setLayoutParams(params);
snack.show(); 

As like youtube Snackbar you have to create a custom Snackbar. You can refer :-https://stackoverflow.com/a/33441214/9294169 for creating it.

If you want more control over Snackbar animation, positions etc you can also use Crouton Library for creating Custom Snackbar.

Here is this link for Crouton:- https://github.com/keyboardsurfer/Crouton

Chirag Sharma
  • 888
  • 6
  • 18