I want to create DialogFragment with custom ui. It's important for me to use custom layout made by myself. But when returning one from onCreateView DialogFragment shows nothing. By the way when use same code in simple Fragment's child, view shows as expected.
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
val context = requireActivity()
contentLoaderView = createContentLoaderView(context)
return contentLoaderView
}
private fun createContentLoaderView(context: Context): ContentLoaderView{
return ContentLoaderView(context).apply{
attachContentView(R.layout.dialog_product_order)
attachViewModel(viewLifecycleOwner, viewModel)
layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
}
}
While when i use the inflater all is nice.
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
return LayoutInflater.from(context).inflate(R.layout.dialog_product_order, container, false)
}
What am i doing wrong?