Я создал генерического создателя листа Bootm. Нижний лист занимает менее половины экрана. Однако после открытия нижнего листа я не могу взаимодействовать с экраном за ним. Другая половина, где присутствует нижний лист, не позволяет мне настаивать на этой части экрана. < /P>
class GenericBottomSheet(private val bottomSheettheme : Int): BottomSheetDialogFragment() {
var customView: View? = null
lateinit var bottomSheet: View
lateinit var bottomSheetBehavior: BottomSheetBehavior
override fun getTheme(): Int = this.bottomSheettheme
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog = BottomSheetDialog(requireContext(), theme)
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val view = inflater.inflate(R.layout.fragment_dynamic_bottom_sheet, container, false)
bottomSheet = view.findViewById(R.id.bottom_sheet)
bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet)
bottomSheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED
customView?.let {
val containerView = view.findViewById(R.id.dynamicContentContainer)
if (it.parent != null){
(it.parent as ViewGroup).removeView(it)
}
containerView.addView(it)
}
return view
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
}
companion object {
fun newInstance(customView: View,bottomSheettheme : Int = R.style.BottomSheetDialogTheme): GenericBottomSheet {
val fragment = GenericBottomSheet(bottomSheettheme)
fragment.customView = customView
return fragment
}
}
< /code>
} < /p>
fragment_dynamic_bottom_sheet.xml
Подробнее здесь: https://stackoverflow.com/questions/794 ... ack-screen