Friday, 14 December 2018

Modal BottomSheetDialog with fullscreen ToolBar and Softkeyboard

How is it possible to create a modal BottomSheetDialog(Fragment) which switches to fullscreen with a ToolBar as shown in the Material Design Spec?

enter image description here

I could add a ToolBar manually by adding a BottomSheetBehavior.BottomSheetCallback and setting the alpha of the ToolBar depending on the slideOffset. This is a bit hacky but seems to work, when moving the Bottom Sheet. However this doesn't work when my Bottom Sheet contains an EditText and the Keyboard is shown. I tried both Versions: BottomSheetDialogFragment and manually adding the Behavior to a new Fragment.

  • Is there an easier way to achieve this?
  • Can I trigger the ToolBar when the Keyboard is shown and the Bottom Sheet uses up the whole space?


from Modal BottomSheetDialog with fullscreen ToolBar and Softkeyboard

No comments:

Post a Comment