title: Is it possible to disable MotionLayout?
body: <p>I'v got a <code>Fragment</code> that hosts a <code>RecyclerView</code> within a <code>MotionLayout</code>. On top of the recycler view I've got a view that collapses and expands, all done in my motion scene. It is triggered by a click as well as responding to dragging the recycler view. So far this all works as intended.</p>
  <p>Now comes the crux: I'd like to hide the collapsing views completely for some states within my app.
  But if I set the views visibility or change its height, it still comes back into view when I drag the recyclerview.</p>
  <p>So is it possible to disable the MotionLayout completely (Lock the constraints) until I enable it again. To disable the drag recogniser would also be a viable solution.</p>
  <p>Now some simplified XML to demonstrate the situation.</p>
  <p>The layout containing the motion layout with header view and recyclerview</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;androidx.constraintlayout.motion.widget.MotionLayout
      xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:id=&quot;@+id/favouritesMotionLayout&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      app:layoutDescription=&quot;@xml/favourites_motion_scene&quot;
      android:animateLayoutChanges=&quot;true&quot;&gt;
  
      &lt;ImageView
          android:id=&quot;@+id/headerView&quot;
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;wrap_content&quot;
          ...
          /&gt;
  
      &lt;androidx.swiperefreshlayout.widget.SwipeRefreshLayout
          android:id=&quot;@+id/swipeRefreshLayout&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;0dp&quot;
          ...
      &gt;
  
          &lt;androidx.recyclerview.widget.RecyclerVieww
              android:id=&quot;@+id/favoritesList&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;match_parent&quot; /&gt;
  
      &lt;/androidx.swiperefreshlayout.widget.SwipeRefreshLayout&gt;
  
  &lt;/androidx.constraintlayout.motion.widget.MotionLayout&gt;
  </code></pre>
  <p>The corresponding motion scene:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;MotionScene
      xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:motion=&quot;http://schemas.android.com/apk/res-auto&quot;
  &gt;
  
      &lt;Transition
          motion:constraintSetStart=&quot;@id/expanded&quot;
          motion:constraintSetEnd=&quot;@id/collapsed&quot;
          motion:duration=&quot;300&quot;&gt;
          &lt;OnSwipe
              motion:touchAnchorId=&quot;@id/swipeRefreshLayout&quot;
              motion:touchAnchorSide=&quot;top&quot;
              motion:dragDirection=&quot;dragUp&quot; /&gt;
      &lt;/Transition&gt;
  
      &lt;ConstraintSet android:id=&quot;@+id/expanded&quot;&gt;
          ... Constraints for expanded header ...
      &lt;/ConstraintSet&gt;
  
      &lt;ConstraintSet android:id=&quot;@+id/collapsed&quot;&gt;
          ... ... Constraints for collapsed header ...
      &lt;/ConstraintSet&gt;
  
  &lt;/MotionScene&gt;
  </code></pre>
  <p>Using constraint layout version &quot;2.0.0-alpha3&quot;</p>
  <p><code>implementation &quot;com.android.support.constraint:constraint-layout:2.0.0-alpha3&quot;</code></p>
  <p>So recap: I'd like to be able to disable the motion layout, so that I can scroll the recyclerview without the header expanding, until I tell it to be enabled again.
  Unfortunately it is not as easy as <code>favouritesMotionLayout.isEnabled = false</code>, but that is the way I was thinking.</p>