Reputation: 3804
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 behind the BottomSheetDialogFragment. Is there a way to keep keyboard opened behind bottomSheetDialogFragment when I show the BottomSheetDialogFragment and prevent keyboard from being dismissed?
I am showing the BottomSheetDialogFragment like this:
modalBottomSheet.show(
(activity as AppCompatActivity).supportFragmentManager,
ModalBottomSheet.TAG + System.currentTimeMillis().toString()
)
Upvotes: 0
Views: 168
Reputation: 3804
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);
Upvotes: 1