android - button visibility on bottom sheet behavior change -


i have button called share on bottomsheet ,now want button visible if state expanded , in other state button should not visible. here code have tried.

     if (mbottomsheetbehavior.getstate() == bottomsheetbehavior.state_expanded) {share.setvisibility(view.visible);}     if(mbottomsheetbehavior.getstate()==bottomsheetbehavior.state_collapsed){share.setvisibility(view.gone);}     if(mbottomsheetbehavior.getstate()==bottomsheetbehavior.state_settling){share.setvisibility(view.gone);}     if(mbottomsheetbehavior.getstate()==bottomsheetbehavior.state_settling){share.setvisibility(view.gone);} 

but when drag bottomsheet expand or collapse nothing happens , there correct way don't know

you can try this

mbottomsheetbehavior.setbottomsheetcallback(new bottomsheetbehavior.bottomsheetcallback() {      @override      public void onstatechanged(view bottomsheet, int newstate) {          if (newstate == bottomsheetbehavior.state_expanded) {                 share.setvisibility(view.visible);          }else{                 share.setvisibility(view.gone);          }      }         @override      public void onslide(view bottomsheet, float slideoffset) {      }  });


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -