Hello, I am currently using Splitties View DSL <ht...
# android
Hello, I am currently using Splitties View DSL https://github.com/LouisCAD/Splitties/tree/master/modules/views-dsl and I came across the following issue. • Attempting to start an AlertDialog with a custom size. I can't customize the size of the root layout (since we don't use a parent ViewGroup, aware of how LayoutInflater + Parent + attach to parent works)
Copy code
override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? = EnsureDialogUi(requireContext()).apply {
        yesButton.setOnClickListener {

        noButton.setOnClickListener {

// 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?
👍 1
Hello @PenguinDan, there's an issue here:
Copy code
layoutParams = ConstraintLayout.LayoutParams(
            DeviceUtil.calcDiagRatioInt(0.33f), wrapContent
are only for views that are going into a
, which is not the case of the
here. You need to use
Hey! I've just tried the above paramaters and it looks like the constraintLayout's layoutParams default back to (wrapContent, wrapContent) or (matchConstraint, matchConstraint)
I can definitely create and post a test application to github to explore the issue
https://github.com/PenguinDan/CustomDialogTest In the above project, there are 2 classes, CustomDialog which uses a CustomDialogUi. • I simply set the layoutParams in CustomDialogUi to some custom value, but no matter what I change it to, it does not matter.
Sorry, but I found the issue. DialogFragment's onCreateDialog has a
setContentView(ViewGroup, LayoutParams)
method, and we can directly set the custom LayoutParams value in there
👍 1