Skip to content Skip to sidebar Skip to footer

Prevent Bottomsheetdialogfragment From Hiding Keyboard

If I have keyboard opened in current activity/fragment, when I present the BottomSheetDialogFragment, keyboard gets dismissed, but I want the keyboard to stay up in the background

Solution 1:

I figured it out. In your BottomSheetDialogFragment's subclass, in the method: override fun setupDialog(dialog: Dialog, style: Int), do:

dialog.window?.setFlags(
            WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
            WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

Post a Comment for "Prevent Bottomsheetdialogfragment From Hiding Keyboard"