Q:

RecyclerView Animate Layout Changes Not Working Fine

I have the next structure:
Activity 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>

Activity 2:
Form to add new item to the recycler View.

XML of the RecyclerView:
<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"/>

I create the item in the second Activity and use startActivityForResult to add the item in the activity one, and then call adapter.notifyItemInserted(0). 
The problem is when the item is added, the insert animation does not working properly, but if I don't use the second activity and create the item in the first activity and add to the adapter, it works fine.
¿How can I solve this?

A:

Your xml structure might be the problem, check your layout_behaviors and use of CoordinatorLayout
Android CoordinatorLayout 
For a nice guide on how to use CoordinatorLayout and layout_behavior check this blog
I've also found that the use of android:animateLayoutChanges="true" can be very glitchy/buggy in a scrollable RecyclerView, I would suggest not using it. For non-scrollable RecyclerViews it works fine tho.

