snackbar

FloatingActionButton does not come down when dismissing Snackbar

我的梦境 提交于 2019-11-30 08:50:12
I am trying to use a Snackbar . I have a FloatingActionButton wrapped in a CoordinatorLayout . When the Snackbar shows, the button is correctly moved up. When it dismisses automatically, the button moves down. But if I dismiss the Snackbar programmatically, the button does not go down. My code is simple: mSnackbar = Snackbar.make(mCoordinatorLayout, text, Snackbar.LENGTH_LONG) .setAction(R.string.undo, new View.OnClickListener() { @Override public void onClick(View v) { undoDeleteTasks(); } }); mSnackbar.show(); Is there a way to make the FloatingActionButton move down when the Snackbar is

Android SnackBar: error inflating SnackbarLayout

我的梦境 提交于 2019-11-30 07:54:35
问题 I wanted to try out the new Snackbar from the official design library provided by Google. Its usage is very close to a Toast so I thought it would be simple enough to try out. I've tried it out on an emulator running 5.1 as well as Samsung Galaxy S6 Edge running 5.0. My problem is that the app crashes when it's supposed to display the Snackbar. Code package com.jayway.andreas.test; import android.app.Activity; import android.os.Bundle; import android.support.design.widget.Snackbar; import

How to use setDuration() method in SnackBar (Android Design Support Library)

此生再无相见时 提交于 2019-11-29 22:06:06
From Documentation: parameter duration - either be one of the predefined lengths: LENGTH_SHORT, LENGTH_LONG, or a custom duration in milliseconds . But I can't set custom duration. For example Snackbar .make(parentLayout, "Feed cat?", 8000) // try here .setAction("Yes", snackOnClickListener) .setActionTextColor(Color.MAGENTA) .setDuration(8000) // try here .show(); but instead of 8 seconds Snackbar gone quickly. CommonsWare Based on the implementation of Snackbar and SnackbarManager , I can confirm Eugene H's assessment: it's a bug. From SnackbarManager : private void scheduleTimeoutLocked

How do I change an Android Snackbar's initial alignment from bottom to top?

六眼飞鱼酱① 提交于 2019-11-29 17:11:30
问题 The recent android library came out just a few days ago, but I would like to have the SnackBar appear on top of the screen, preferably within a RelativeLayout as it's parent view. How does one change the SnackBar 's initial alignment which I presume to be layout_alignParentBottom to layout_alignParentTop ? 回答1: It is possible to make the snackbar appear on top of the screen using this: Snackbar snack = Snackbar.make(parentLayout, str, Snackbar.LENGTH_LONG); View view = snack.getView();

FloatingActionButton does not come down when dismissing Snackbar

一个人想着一个人 提交于 2019-11-29 13:53:44
问题 I am trying to use a Snackbar . I have a FloatingActionButton wrapped in a CoordinatorLayout . When the Snackbar shows, the button is correctly moved up. When it dismisses automatically, the button moves down. But if I dismiss the Snackbar programmatically, the button does not go down. My code is simple: mSnackbar = Snackbar.make(mCoordinatorLayout, text, Snackbar.LENGTH_LONG) .setAction(R.string.undo, new View.OnClickListener() { @Override public void onClick(View v) { undoDeleteTasks(); } }

Android SnackBar: error inflating SnackbarLayout

拈花ヽ惹草 提交于 2019-11-29 05:35:05
I wanted to try out the new Snackbar from the official design library provided by Google. Its usage is very close to a Toast so I thought it would be simple enough to try out. I've tried it out on an emulator running 5.1 as well as Samsung Galaxy S6 Edge running 5.0. My problem is that the app crashes when it's supposed to display the Snackbar. Code package com.jayway.andreas.test; import android.app.Activity; import android.os.Bundle; import android.support.design.widget.Snackbar; import android.view.View; public class MainActivity extends Activity { @Override protected void onCreate(Bundle

Display SnackBar in Flutter

吃可爱长大的小学妹 提交于 2019-11-28 22:50:27
I want to display a simple SnackBar inside Flutter 's stateful widget. My application creates new instance of MaterialApp with a stateful widget called MyHomePage . I try to show the SnackBar in showSnackBar() method. But it fails with ' The method 'showSnackBar' was called on null '. What's wrong with this code? class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( title: 'Flutter', theme: new ThemeData( primarySwatch: Colors.blue, ), home: new MyHomePage(), ); } } class MyHomePage extends StatefulWidget { MyHomePage({Key key}) : super

Scaffold.of() called with a context that does not contain a Scaffold

那年仲夏 提交于 2019-11-28 17:42:33
As you can see my button is inside Scaffold's body. But I get this exception: Scaffold.of() called with a context that does not contain a Scaffold. import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: HomePage(), ); } } class HomePage extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('SnackBar Playground'), ), body: Center(

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

↘锁芯ラ 提交于 2019-11-27 22:20:17
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) { getOps().cancelLogin(); enableControls(); } }); loadingSnack.getView().setOnTouchListener(new View

How can I be notified when a Snackbar has dismissed itself?

梦想与她 提交于 2019-11-27 17:56:42
I'm using a Snackbar from the com.android.support:design:22.2.0 library. I'm using it to undo deletions. To make my life easier, I'm going to make the UI look like things are actually deleted from the data source, and if the undo button in the snack bar is not pressed, actually perform the deletions from the data source. So, I want to know when the Snackbar is no longer visible, so it's safe to delete the items. I can call getView() on the Snackbar, but I'm not sure what listener I should be using. I tried setOnSystemUiVisibilityChangeListener() but that didn't work, I believe it is only for