title: MotionLayout i can't scroll my RecyclerView to first poisiton
body: <p>I have a activity_motion_sec.xml file as below. It is almost same with this sample <a href="https://riggaroo.dev/android-motionlayout-tutorial-collapsing-view/" rel="nofollow noreferrer">https://riggaroo.dev/android-motionlayout-tutorial-collapsing-view/</a>. What i have added is a simple up arrow button. I want my recyclerview to scroll to 0. position when up-arrow button is pressed.</p>
  <p>activity_motion_sec.xml</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;
  android:layout_width=&quot;match_parent&quot;
  android:layout_height=&quot;match_parent&quot;
  android:orientation=&quot;vertical&quot;
  app:layoutDescription=&quot;@xml/base_scroll_scene&quot;
  app:showPaths=&quot;false&quot;&gt;
  
  &lt;ImageView
      android:id=&quot;@+id/imageViewAvatar&quot;
      android:layout_width=&quot;140dp&quot;
      android:layout_height=&quot;0dp&quot;
      android:layout_marginStart=&quot;16dp&quot;
      android:layout_marginTop=&quot;16dp&quot;
      android:scaleType=&quot;centerCrop&quot;
      app:layout_constraintDimensionRatio=&quot;h,1:1&quot;
      app:layout_constraintStart_toStartOf=&quot;parent&quot;
      app:layout_constraintTop_toTopOf=&quot;parent&quot;
      android:src=&quot;@drawable/bursa&quot; /&gt;
  
  
  &lt;TextView
      android:id=&quot;@+id/textViewName&quot;
      android:layout_width=&quot;0dp&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:layout_marginStart=&quot;16dp&quot;
      android:layout_marginTop=&quot;8dp&quot;
      android:layout_marginEnd=&quot;16dp&quot;
      android:layout_marginBottom=&quot;8dp&quot;
      android:fontFamily=&quot;@font/raleway_semibold&quot;
      android:text=&quot;Veruca Salt &quot;
      android:textAppearance=&quot;@style/TextAppearance.AppCompat.Display1&quot;
      app:layout_constraintBottom_toTopOf=&quot;@+id/space&quot;
      app:layout_constraintEnd_toEndOf=&quot;parent&quot;
      app:layout_constraintStart_toEndOf=&quot;@+id/imageViewAvatar&quot;
      app:layout_constraintTop_toTopOf=&quot;@+id/imageViewAvatar&quot; /&gt;
  
  
  &lt;androidx.recyclerview.widget.RecyclerView
      android:id=&quot;@+id/recyclerViewStatus&quot;
      android:layout_width=&quot;0dp&quot;
      android:layout_height=&quot;0dp&quot;
      android:layout_marginStart=&quot;8dp&quot;
      android:layout_marginTop=&quot;8dp&quot;
      android:layout_marginEnd=&quot;8dp&quot;
      app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
      app:layout_constraintEnd_toEndOf=&quot;parent&quot;
      app:layout_constraintStart_toStartOf=&quot;parent&quot;
      app:layout_constraintTop_toBottomOf=&quot;@+id/imageViewAvatar&quot;
      &gt;
  
  &lt;/androidx.recyclerview.widget.RecyclerView&gt;
  
  
  &lt;View
      android:id=&quot;@+id/my_view&quot;
      android:layout_width=&quot;0dp&quot;
      android:layout_height=&quot;30dp&quot;
      app:layout_constraintEnd_toEndOf=&quot;parent&quot;
      app:layout_constraintTop_toTopOf=&quot;@id/space&quot;
      app:layout_constraintStart_toStartOf=&quot;parent&quot;
      android:background=&quot;@drawable/bottom_gradient_mask&quot;
      android:visibility=&quot;gone&quot;/&gt;
  
  &lt;ImageView
      android:id=&quot;@+id/up_arrow&quot;
      android:layout_width=&quot;30dp&quot;
      android:layout_height=&quot;30dp&quot;
      android:src=&quot;@drawable/ic_arrow_upward_black_24dp&quot;
      android:visibility=&quot;gone&quot;
      app:layout_constraintEnd_toEndOf=&quot;@+id/space&quot;
      app:layout_constraintTop_toTopOf=&quot;@+id/space&quot;/&gt;
  
  
  &lt;Space
      android:id=&quot;@+id/space&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;8dp&quot;
      app:layout_constraintEnd_toEndOf=&quot;parent&quot;
      app:layout_constraintStart_toStartOf=&quot;@+id/imageViewAvatar&quot;
      app:layout_constraintTop_toBottomOf=&quot;@id/imageViewAvatar&quot; /&gt;
  
  &lt;/androidx.constraintlayout.motion.widget.MotionLayout&gt;
  </code></pre>
  <p>In base_scroll_scene.xml file, i can handle the click event of up-arrow button. Animation runs when button is clicked but i could not set recyclerview position.</p>
  <p>base_scroll_scene.xml</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:app=&quot;http://schemas.android.com/apk/res-auto&quot;&gt;
  
  &lt;Transition
      app:constraintSetEnd=&quot;@id/end&quot;
      app:constraintSetStart=&quot;@id/start&quot;
      app:duration=&quot;1000&quot;&gt;
      &lt;OnSwipe
          app:dragDirection=&quot;dragUp&quot;
          app:touchAnchorId=&quot;@+id/recyclerViewStatus&quot;
          app:touchAnchorSide=&quot;top&quot; /&gt;
      &lt;OnClick
          app:targetId=&quot;@id/up_arrow&quot;
          app:clickAction=&quot;transitionToStart&quot;/&gt;
  &lt;/Transition&gt;
  
  &lt;ConstraintSet android:id=&quot;@+id/start&quot;&gt;
      &lt;Constraint
          android:id=&quot;@+id/recyclerViewStatus&quot;
          /&gt;
  &lt;/ConstraintSet&gt;
  
  &lt;ConstraintSet android:id=&quot;@+id/end&quot;&gt;
  
      &lt;Constraint
          android:id=&quot;@id/imageViewAvatar&quot;
          android:layout_width=&quot;40dp&quot;
          android:layout_height=&quot;40dp&quot;
          android:layout_marginStart=&quot;16dp&quot;
          android:layout_marginTop=&quot;16dp&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot;
          /&gt;
  
      &lt;Constraint
          android:id=&quot;@id/space&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;30dp&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintStart_toStartOf=&quot;@+id/imageViewAvatar&quot;
          app:layout_constraintTop_toBottomOf=&quot;@id/imageViewAvatar&quot;/&gt;
  
      &lt;Constraint
          android:id=&quot;@+id/up_arrow&quot;
          android:layout_width=&quot;30dp&quot;
          android:layout_height=&quot;30dp&quot;
          android:src=&quot;@drawable/ic_arrow_upward_black_24dp&quot;
          android:visibility=&quot;visible&quot;
          app:layout_constraintEnd_toEndOf=&quot;@+id/space&quot;
          app:layout_constraintTop_toTopOf=&quot;@+id/space&quot;/&gt;
  
      &lt;Constraint
          android:id=&quot;@+id/my_view&quot;
          android:layout_width=&quot;0dp&quot;
          android:layout_height=&quot;30dp&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;@id/space&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          android:background=&quot;@drawable/bottom_gradient_mask&quot;
          android:visibility=&quot;visible&quot;/&gt;
  
  &lt;/ConstraintSet&gt;
  
  &lt;/MotionScene&gt;
  </code></pre>
  <p>I have tried to set a ClickListener in my java file but it did not work. The view does not listen the event listener which i set in MotionActivitySec.java
  and MotionActivitySec.java</p>
  <pre><code>public class MotionActivitySec extends Activity {
  
  
  @Override
  protected void onCreate(@Nullable Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_motion_sec);
  
      MyListData[] myListData = new MyListData[] {
              new MyListData(&quot;Email&quot;, android.R.drawable.ic_dialog_email),
              new MyListData(&quot;Info&quot;, android.R.drawable.ic_dialog_info),
              new MyListData(&quot;Delete&quot;, android.R.drawable.ic_delete),
              new MyListData(&quot;Dialer&quot;, android.R.drawable.ic_dialog_dialer),
              new MyListData(&quot;Alert&quot;, android.R.drawable.ic_dialog_alert),
              new MyListData(&quot;Map&quot;, android.R.drawable.ic_dialog_map),
              new MyListData(&quot;Email&quot;, android.R.drawable.ic_dialog_email),
              new MyListData(&quot;Info&quot;, android.R.drawable.ic_dialog_info),
              new MyListData(&quot;Delete&quot;, android.R.drawable.ic_delete),
              new MyListData(&quot;Dialer&quot;, android.R.drawable.ic_dialog_dialer),
              new MyListData(&quot;Alert&quot;, android.R.drawable.ic_dialog_alert),
              new MyListData(&quot;Map&quot;, android.R.drawable.ic_dialog_map),
      };
  
      final RecyclerView recyclerView = findViewById(R.id.recyclerViewStatus);
      MyAdapter adapter = new MyAdapter(myListData);
      recyclerView.setHasFixedSize(true);
      recyclerView.setLayoutManager(new LinearLayoutManager(this));
      recyclerView.setAdapter(adapter);
  
      ImageView imageView = findViewById(R.id.up_arrow);
  
      imageView.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Toast.makeText(MotionActivitySec.this, &quot;clicked&quot;, Toast.LENGTH_SHORT).show();
              recyclerView.scrollToPosition(0);
          }
      });
      
  }
  }
  </code></pre>