How to readjust Constraint Layout
<p>In my app, I have a custom layout that use Constraint Layout to display two views as follow.</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;android.support.constraint.ConstraintLayout
       xmlns:android="http://schemas.android.com/apk/res/android"
       xmlns:tools="http://schemas.android.com/tools"
       xmlns:app="http://schemas.android.com/apk/res-auto"
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:orientation="vertical"&gt;

    &lt;android.support.constraint.Guideline
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/guideline2"
        android:orientation="horizontal"
        tools:layout_editor_absoluteY="444dp"
        tools:layout_editor_absoluteX="0dp"
        app:layout_constraintGuide_percent="0.5"/&gt;

    &lt;CategorySelectionLayout
        android:id="@+id/categoryList"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:orientation="horizontal"
        android:gravity="center_vertical"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="@+id/guideline2"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintRight_toRightOf="parent" /&gt;
    &lt;CategoryNavigationLayout
        android:id="@+id/navigation"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:orientation="horizontal"
        android:gravity="center_vertical"
        android:paddingLeft="@dimen/one_grid"
        tools:layout_manager="android.support.v7.widget.LinearLayoutManager"
        tools:listitem="@layout/order_selection_item"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintBottom_toTopOf="@+id/guideline2" /&gt;
&lt;/android.support.constraint.ConstraintLayout&gt;
</code></pre>

<p>Now imagine when there's nothing to display inside categoryList, I'd like to hide it(View.GONE) then resize the constraint layout to only use the space required for navigation layout.</p>

<p>I have tried to set visibility inside custom view. </p>

<pre><code>this.visibility = View.GONE
this.parent.requestLayout()
</code></pre>

<p>The view is now hidden but parent did not adjust the size accordingly.</p>

<p>So how do I force this ConstraintLayout to readjust it's size?</p>