Inflating ConstraintLayout in another ConstraintLayout

Thanks to Cheticamp for pointing me in the right direction. I was inflating the ConstraintLayout with the root layout and not with the Constraint Layout it is supposed to be in. So the correct Javacode is:

    parentView = rootView.findViewById(R.id.parentView);
    ViewGroup parentView = rootView.findViewById(R.id.parentView);
    final ConstraintLayout innerArea = (ConstraintLayout) 
    inflater.inflate(R.layout.inner_area, parentView, false);
    parentView.addView(innerArea);

I seem to be very late to the party but I tried lots of things to solve this problem but nothing worked.

I ended up just putting the inner constraint layout inside another layout (a relative layout in my case) which solved the problem for me.