今天我想知道是否有可能做到这一点。我的意思是,当我加载子视图时发送父视图。换句话说,当我在孩子身上时,我想处理父母。
父视图
imgFilter.setOnClickListener {
MyDialogFragment().show(requireActivity().supportFragmentManager,"filter_dialog")
}
子视图
class MyDialogFragment : BottomSheetDialogFragment() {
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val dialog = super.onCreateDialog(savedInstanceState) as BottomSheetDialog
val view = View.inflate(context, R.layout.filter_sheet_layout, null)
val linearLayout = view.findViewById<LinearLayout>(R.id.root)
val params = linearLayout.layoutParams as LinearLayout.LayoutParams
params.height = getScreenHeight()
linearLayout.layoutParams = params
backArrowClick(view)
hideKeyboard()
dialog.setContentView(view)
mBehavior = BottomSheetBehavior.from(view.parent as View)
parentFragment?.view?.findViewById<TextView>(R.id.name_store)?.text = "Hello World"
return dialog
}
}
如果有可能,我不知道,或者如果您有其他建议,我会在这里听取和学习。
太感谢了!