animateLayoutChanges="true" ... />

当对布局中的view加入删除,隐藏或显示, 都会有一个淡入淡出,和位移动画.


animateLayoutChanges 属性。也能够创建 LayoutTransition

private ViewGroup mContainerView;  
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.custom_linear_layout);
    mContainerView = (ViewGroup) findViewById(R.id.container);
    LayoutTransition lt = new LayoutTransition();
    lt.disableTransitionType(LayoutTransition.DISAPPEARING);
    mContainerView.setLayoutTransition(lt);