Skip to content

Instantly share code, notes, and snippets.

@seriabov
Created July 3, 2017 10:59
Show Gist options
  • Save seriabov/3705c1e78f342f47cac8f5e386b42f06 to your computer and use it in GitHub Desktop.
Save seriabov/3705c1e78f342f47cac8f5e386b42f06 to your computer and use it in GitHub Desktop.
Enable animatelayoutchanges when change not caused by items being added to or removed
Enable animatelayoutchanges when change not caused by items being added to or removed
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
((ViewGroup) findViewById(R.id.llRoot)).getLayoutTransition()
.enableTransitionType(LayoutTransition.CHANGING);
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/llRoot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:animateLayoutChanges="true"
android:background="@android:color/holo_blue_bright"
android:gravity="center"
android:orientation="horizontal"
android:padding="10dp">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@mipmap/ic_launcher"/>
<TextView
android:id="@+id/tvText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="some text"
android:textAppearance="?android:attr/textAppearanceMedium"/>
</LinearLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment