Created
July 7, 2021 14:03
-
-
Save ibrahimsn98/67c5e832b39178bba10b0db78a845c46 to your computer and use it in GitHub Desktop.
Android Appending Sticky Bottom Sheet View
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
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | |
val bottomSheetDialog = super.onCreateDialog(savedInstanceState) as BottomSheetDialog | |
bottomSheetDialog.setOnShowListener { | |
val containerLayout = dialog?.findViewById( | |
com.google.android.material.R.id.container | |
) as? FrameLayout | |
val buttonLayout = LayoutInflater.from(dialog?.context) | |
.inflate(R.layout.layout_delivery_bottom_sheet_buttons, null) | |
.findViewById<LinearLayout>(R.id.layoutButtons) | |
val parent = buttonLayout?.parent as? ViewGroup | |
parent?.removeView(buttonLayout) | |
containerLayout?.addView( | |
buttonLayout, | |
containerLayout.childCount | |
) | |
} | |
return bottomSheetDialog | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment