Skip to content

Instantly share code, notes, and snippets.

@ibrahimsn98
Created July 7, 2021 14:03
Show Gist options
  • Save ibrahimsn98/67c5e832b39178bba10b0db78a845c46 to your computer and use it in GitHub Desktop.
Save ibrahimsn98/67c5e832b39178bba10b0db78a845c46 to your computer and use it in GitHub Desktop.
Android Appending Sticky Bottom Sheet View
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