私は次の構造を有する:アニメイトレイアウト変更リサイクル業者は、表示はありません作業罰金
活動1:
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/FAB_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</android.support.design.widget.CoordinatorLayout>
活動2:
<android.support.v7.widget.RecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"/>
:RecyclerViewの
Form to add new item to the recycler View.
XMLを
私はiを作成しますstartActivityForResultを使用してアクティビティ1に項目を追加し、次にadapter.notifyItemInserted(0)を呼び出します。
問題は、アイテムが追加され、挿入アニメーションが正しく機能しない場合ですが、2番目のアクティビティを使用せずに最初のアクティビティでアイテムを作成してアダプタに追加すると問題なく動作します。
¿この問題を解決するにはどうすればよいですか?
あなたのメインCoordinatorLayout –
にanimateLayoutChanges = "true"を追加します。それを試してみますが、FABが消えて後で表示しようとすると正しく動作せず、 "フラッシュ" –