Created
July 29, 2021 02:11
-
-
Save yasukotelin/31ed251b514e011c6aaaada1b92ae780 to your computer and use it in GitHub Desktop.
BottomSheetDialogFragmentを全画面表示するExtension。onViewCreatedでcallする。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* BottomSheetDialogを全画面表示する | |
*/ | |
fun BottomSheetDialogFragment.fullScreen() { | |
dialog?.setOnShowListener { dialog -> | |
val d = dialog as BottomSheetDialog | |
val bottomSheet = | |
d.findViewById<FrameLayout>(R.id.design_bottom_sheet) ?: return@setOnShowListener | |
bottomSheet.layoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT | |
val screenHeight = Resources.getSystem().displayMetrics.heightPixels | |
BottomSheetBehavior.from(bottomSheet).peekHeight = screenHeight | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment