Questions tagged [android-snackbar]

Snackbars provide lightweight feedback about an operation. 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.

Introduction

Snackbars provide lightweight feedback about an operation. 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.

They automatically disappear after a timeout or after user interaction elsewhere on the screen, particularly after interactions that summon a new surface or activity. Snackbars can be swiped off screen.

Snackbars can contain an action which is set via setAction(CharSequence, android.view.View.OnClickListener).

Documentation

Usage of SnackBar

477 questions
51
votes
3 answers

Testing Snackbar show with Espresso

Is there a way to test using Espresso that the snackbar shows up with the right text? I have a simple call to create a snackbar Snackbar.make(mView, "My text", Snackbar.LENGTH_LONG).show(); I have tried this without luck onView(withText("My…
49
votes
9 answers

How to move a view above Snackbar just like FloatingButton

I got a linear layout that I want to move up when a Snackbar appears. I saw many examples how to do this with FloatingButton, but what about a regular view?
Ilya Gazman
  • 31,250
  • 24
  • 137
  • 216
46
votes
5 answers

Snackbar action text color not changing

I want to change the action text color for my snackbar, but it is not working for some reason. I use the following code to display a snackbar: Snackbar.make(findViewById(R.id.root), "text",…
43
votes
6 answers

How to prevent my snackbar text from being truncated on Android?

I am displaying a snackbar with a fairly long text message and on the phone in portrait mode it looks fine. But on the tablet it seems to only allow 1 line of text so it gets ellipsis-ed Is there anyway I can get it to be 2 line in tablet…
arinte
  • 3,660
  • 10
  • 45
  • 65
42
votes
5 answers

How can you adjust Android SnackBar to a specific position on screen

Follwing the new android snackbar, i'm trying to set it to be positioned on a specific y coordinate. Its seems to be not even a possible. I've tried with getting the parent of the snackbar's view, but, there's nothing to be done to the parent for it…
Dus
  • 4,052
  • 5
  • 30
  • 49
40
votes
8 answers

Can we perform 2 different actions in Snack bar at a time in android?

I am creating an android application in which i want to use Snack Bar, In a that snack bar i want 2 different words on which we have to perform 2 different actions.
Anjali Patel
  • 807
  • 2
  • 11
  • 23
37
votes
5 answers

Style SnackBar in theme app

I need help. How can I change the design of the text in snackbar in styles app? The change in the code does not interest me. I found the following code. But it is not working for me. Why is that? My theme is derived from…
34
votes
8 answers

What are the new features of Android Design Support Library and how to use its Snackbar?

Android M Preview for developers was released yesterday. As usual, many amazing new features are introduced. I noticed that Snackbar is one of them. I have read the document about Snackbar, from which I learnt that Snackbar is in the library of…
32
votes
7 answers

Is there any way to add an icon to a Snackbar?

This is my Snackbar code : Snackbar.make(viewHolder.productView, "Some Text Here ..", Snackbar.LENGTH_SHORT) .setAction("I want be a icon here instead TEXT", new View.OnClickListener() { @Override …
Farhad Navayazdan
  • 1,091
  • 3
  • 12
  • 22
31
votes
7 answers

Change position of a Flutter Snackbar

I want to display a simple disappearing error message above a button when certain conditions aren't met. It seems as if Flutter's Snackbar is well suited to this purpose. However, I'm having difficulty changing the position of the Snackbar to be…
mongy910
  • 537
  • 1
  • 5
  • 16
30
votes
6 answers

Right To Left SnackBar

I want to display a text with an action on Design Support Library SnackBar. My language is writen in Right-to-Left. So how can i change SnackBar text and action direction? Something like this:
Seyyed
  • 1,526
  • 3
  • 20
  • 30
27
votes
5 answers

Snackbar package in AndroidX

When migrating a project or switching between branches which are and aren't migrated, Android Studio cannot build projects because it cannot find the android.support.design.widget.Snackbar package. Support/Design packages are removed but the…
Nick Cardoso
  • 20,807
  • 14
  • 73
  • 124
26
votes
20 answers

Add margins to Snackbar view

I'm updating my current app to use snackbars, in the Google spec they show various ways of using them http://www.google.com/design/spec/components/snackbars-toasts.html#snackbars-toasts-specs Example A: Example B: Here's my code atm: Snackbar…
AndroidEnthusiast
  • 6,557
  • 10
  • 42
  • 56
25
votes
5 answers

How to show SnackBar in BottomSheetDialogFragment?

I search alot but couldn't find any solution and Snackbar is not working within fragment class doesn't help. I pass rootView of fragment and also try passing a view from getActivity but none of them works! @Override public View…
24
votes
9 answers

Flutter Showing Snackbar On Top of Bottom Sheet

In my code I call a bottom sheet to display a list of tiles. These tiles contain buttons that display a snackbar. That functionality works fine, the only issue is that the snackbar is displayed behind the bottom sheet so you can only see it if you…
1
2
3
31 32