Well there is a very easy way, but just setting android:animateLayoutChanges="true"
will not work. You need to enableTransitionType in you activity. Check this link for more info: http://www.thecodecity.com/2018/03/android-animation-on-view-visibility.html