简体   繁体   中英

How to make visible an invisible snackbar in an if condition in Android?

I have a question about Snackbar visibility. I set invisible the Snackbar on xml and I want to make it visible in an if condition but i don't know how to do it because I'm new at coding. If you can help me with this I'd be very happy.

Try It,

snackbar.addCallback(new Snackbar.Callback() {

    @Override
    public void onDismissed(Snackbar snackbar, int event) {
      //see Snackbar.Callback docs for event details

    }

    @Override
    public void onShown(Snackbar snackbar) {

    }
  });

Please try this code.

snackbar.addCallback(new Snackbar.Callback() {

    @Override
    public void onDismissed(Snackbar snackbar, int event) {
      //see Snackbar.Callback docs for event details
      ...  
    }

    @Override
    public void onShown(Snackbar snackbar) {
       ...
    }
  });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM