BodsheetDialogfragment lässt die Interaktion mit dem Rückbildschirm nicht zugelassen

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: BodsheetDialogfragment lässt die Interaktion mit dem Rückbildschirm nicht zugelassen

by Anonymous » 15 Feb 2025, 10:43

Ich habe einen generischen Bootm Sheet Creator erstellt. Das untere Blatt nimmt weniger als die Hälfte des Bildschirms ein. Sobald das untere Blatt geöffnet ist, kann ich nicht mit dem Bildschirm dahinter interagieren. Die andere Hälfte, in der das untere Blatt nicht vorhanden ist

Code: Select all

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
  








Top