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

Forum für diejenigen, die für Android programmieren
Anonymous
 BodsheetDialogfragment lässt die Interaktion mit dem Rückbildschirm nicht zugelassen

Post by Anonymous »

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
  







Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post