bottom sheet - android BottomSheet how to collapse when clicked outside? -


i have implemented bottomsheet behavior nestedscrollview. , wondering if possible hide bottomsheet view when touched outside.

finally able this,

used following lines of code:

@override public boolean dispatchtouchevent(motionevent event){     if (event.getaction() == motionevent.action_down) {         if (mbottomsheetbehavior.getstate()==bottomsheetbehavior.state_expanded) {              rect outrect = new rect();             bottomsheet.getglobalvisiblerect(outrect);              if(!outrect.contains((int)event.getrawx(), (int)event.getrawy()))                 mbottomsheetbehavior.setstate(bottomsheetbehavior.state_collapsed);         }     }      return super.dispatchtouchevent(event); } 

Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -