android-snackbar

Android Multiline Snackbar

时光怂恿深爱的人放手 提交于 2019-11-27 04:17:10
问题 I'm trying to leverage new Snackbar from Android Design Support Library to display multiline snackbar, as shown in http://www.google.com/design/spec/components/snackbars-toasts.html#snackbars-toasts-specs: import android.support.design.widget.Snackbar; final String snack = "First line\nSecond line\nThird line"; Snackbar.make(mView, snack, Snackbar.LENGTH_LONG).show(); It displays only First line... on my Nexus 7. How to make it display all lines? PS: I tried Toast and it displayed all lines.

How to disable snackbar's swipe-to-dismiss behavior

為{幸葍}努か 提交于 2019-11-26 20:43:35
问题 Is there a way to prevent the user from dismissing a snackbar by swiping on it? I have an app that shows a snack bar during network login, I want to avoid it to be dismissed. According to Nikola Despotoski suggestion I've experimented both solutions: private void startSnack(){ loadingSnack = Snackbar.make(findViewById(R.id.email_login_form), getString(R.string.logging_in), Snackbar.LENGTH_INDEFINITE) .setAction("CANCEL", new OnClickListener() { @Override public void onClick(View view) {

How to show Snackbar at top of the screen

二次信任 提交于 2019-11-26 15:21:23
问题 As the Android documentation says 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. Is there any alternative by which we can show snackbars at top of the screen instead of the bottom? Right now I am doing something like this which shows a snackbar at the bottom of the screen. Snackbar.make(findViewById(android.R.id.content), "Hello this is a snackbar!!!", Snackbar.LENGTH_LONG).setAction(

how to customize snackBar's layout?

≡放荡痞女 提交于 2019-11-26 00:52:29
问题 Is there any method to change the layout of a snackBar to custom View? Now it comes black and we can change the background color. But I don\'t know the right way to inflate a new layout and making it as snackBars background? Thanks... 回答1: The Snackbar does not allow you to set a custom layout. However, as Primoz990 suggested you can get the Snackbar's View. The getView function returns the Snackbar.SnackbarLayout, which is a horizontal LinearLayout object whose children are a TextView and a

how to customize snackBar's layout?

北战南征 提交于 2019-11-25 18:53:55
Is there any method to change the layout of a snackBar to custom View? Now it comes black and we can change the background color. But I don't know the right way to inflate a new layout and making it as snackBars background? Thanks... Mike The Snackbar does not allow you to set a custom layout. However, as Primoz990 suggested you can get the Snackbar's View. The getView function returns the Snackbar.SnackbarLayout, which is a horizontal LinearLayout object whose children are a TextView and a Button. To add your own View to the Snackbar, you just need to hide the TextView, and add your View to