PenguinDan
05/08/2020, 7:13 PMoverride fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? = EnsureDialogUi(requireContext()).apply {
        yesButton.setOnClickListener {
            ensureListener?.onYes()
            dismissSafely()
        }
        noButton.setOnClickListener {
            cancelSafely()
        }
    }.root
// My Ui code
...
    override val root: View = constraintLayout {
        // Set the parameters of our ConstraintLayout container
        layoutParams = ConstraintLayout.LayoutParams(
            DeviceUtil.calcDiagRatioInt(0.33f), wrapContent
        )
...
Any ideas how I would go about doing this?Dominaezzz
05/08/2020, 7:15 PMlouiscad
05/08/2020, 7:21 PMlayoutParams = ConstraintLayout.LayoutParams(
            DeviceUtil.calcDiagRatioInt(0.33f), wrapContent
        )
ConstraintLayout.LayoutParams are only for views that are going into a ConstraintLayout, which is not the case of the root here.
You need to use ViewGroup.LayoutParams (or ViewGroup.MarginLayoutParams).PenguinDan
05/08/2020, 7:31 PMPenguinDan
05/08/2020, 7:32 PMPenguinDan
05/08/2020, 7:44 PMPenguinDan
05/08/2020, 8:31 PMsetContentView(ViewGroup, LayoutParams)  method, and we can directly set the custom LayoutParams value in there