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.
Asked
Active
Viewed 558 times
1
-
Simple view aligning at top will do the thing. – Vir Rajpurohit Oct 31 '18 at 05:12
1 Answers
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
-
The anser link you shared seems promising.. will take a look on it. – Kushal Bhalaik Oct 31 '18 at 10:11