I've made a simple BaseTopSheetDialog with overridable contentView, you can see a full solution here.
In comparison to the original BottomSheet the behaviour is limited but enough for most use cases, including nested recyclers and complex gesture handling.
Example usage:
class ExampleTopSheetFragment : BaseTopSheetDialogFragment() {
override val contentLayoutId: Int = R.layout.layout_example_dialog_content
private val binding by binding(R.id.content) { LayoutExampleDialogContentBinding::bind } // change according to how you handle viewBinding
override fun isDraggable(): Boolean = true
override fun isCancelableOnTouchOutside(): Boolean = true
override fun onContentViewCreated(view: View, savedInstanceState: Bundle?) {
binding.close.handleDoubleClick { hide() }
binding.title.text = "Hello, World!"
}
/** Use as any other fragment dialog
private fun showTopSheet() {
ExampleTopSheetFragment().show(supportFragmentManager, ExampleTopSheetFragment::class.java.name)
}
*/
}