原文地址:https://developer.android.com/training/animation/layout.html#add
(1)设置布局文件:
<LinearLayout android:id="@+id/container" android:animateLayoutChanges="true" ... />
(2)Java代码
private ViewGroup mContainerView; ... private void addItem() { View newView; ... mContainerView.addView(newView, 0); }