android / views-widgets-samples

Multiple samples showing the best practices in views-widgets on Android.
Apache License 2.0
5.07k stars 3.01k forks source link

Motionlayout contain recyclerView, to update recycleview during animation,after animation recycleview not updated #230

Open 1352101891 opened 3 years ago

1352101891 commented 3 years ago

Motionlayout contain recyclerView, to update recycleview during animation,after animation recycleview not updated。

`<androidx.constraintlayout.motion.widget.MotionLayout android:id="@+id/motionLayout" app:layoutDescription="@xml/scene3" android:layout_width="match_parent" android:layout_height="match_parent" app:showPaths="true">

    <RelativeLayout
        android:id="@+id/testId"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintTop_toBottomOf="parent"
        app:layout_constraintVertical_chainStyle="spread">

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/recycler_media_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="10dp"/>

        <com.google.android.material.floatingactionbutton.FloatingActionButton
            android:id="@+id/media_send_fab"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_alignParentBottom="true"
            android:layout_margin="16dp"
            android:onClick="sendTheMessages"
            app:fabSize="normal" />
    </RelativeLayout>
</androidx.constraintlayout.motion.widget.MotionLayout>`

motionLayout.translateToEnd(); adapter.updateitem(0,size);

it does't not work,RecyclerView not update. but after animation , to do updateitem it's work;