How to insert fragment with behavior into main layout?
Implementation
I need to add BottomSheetBehavior to ToolboxSheetFragment that locate to activity_main.xml. I did it the follow:
// activity_main.xml
But in this case, ToolboxSheetFragment must to know, that behavior locate in parent view.
class ToolboxSheetFragment : Fragment(R.layout.fragment_toolbox_sheet) {
// ...
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
// ...
behavior = BottomSheetBehavior.from(view.parent as View)
}
}...