0

opening slide up bottomsheet by below code

VillazBottomSheet villazBottomSheet=new VillazBottomSheet();
villazBottomSheet.setArguments(bundle);
villazBottomSheet.show(getSupportFragmentManager(),"VillazList");//slideup and open sheet

Now i want to slide down this fragment by backpressed

@Override
    public void onBackPressed()
    {
        villazBottomSheet.slidedown()// I want to do this
    }

How can I do this ? what i had tried

Vora Ravi
  • 5
  • 5
  • Does this answer your question? [Show and Hide Bottom Sheet Programmatically](https://stackoverflow.com/questions/42293488/show-and-hide-bottom-sheet-programmatically) – Walid Jan 27 '21 at 21:06
  • i tried it, it not slide bottom, it directly disappears from acivity – Vora Ravi Jan 27 '21 at 21:09

1 Answers1

0

Try this:

BottomSheetBehavior.from(villazBottomSheet).setState(BottomSheetBehavior.STATE_COLLAPSED)
Sam Chen
  • 7,597
  • 2
  • 40
  • 73