Created
December 24, 2019 07:42
-
-
Save ch8n/65dba9188996b9b63ab749fd9d21f502 to your computer and use it in GitHub Desktop.
BottomSheet Fragment access state
This file contains hidden or 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
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | |
val bottomSheet: BottomSheetDialog = super.onCreateDialog(savedInstanceState) as BottomSheetDialog | |
bottomSheet.setOnShowListener { dialog -> | |
val bottomSheetDialog: BottomSheetDialog? = dialog as? BottomSheetDialog | |
val bottomSheetBehaviour = bottomSheetDialog?.findViewById(com.google.android.material.R.id.design_bottom_sheet) as? FrameLayout | |
BottomSheetBehavior.from(bottomSheetBehaviour).setState(BottomSheetBehavior.STATE_EXPANDED) | |
} | |
return bottomSheet | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment