Example usage for android.view.animation AnimationUtils loadLayoutAnimation

List of usage examples for android.view.animation AnimationUtils loadLayoutAnimation

Introduction

In this page you can find the example usage for android.view.animation AnimationUtils loadLayoutAnimation.

Prototype

public static LayoutAnimationController loadLayoutAnimation(Context context, @AnimRes int id)
        throws NotFoundException 

Source Link

Document

Loads a LayoutAnimationController object from a resource

Usage

From source file:com.example.android.home.Home.java

/**
 * Hides all of the applications by playing an animation on the grid.
 *//*from w  w  w. j ava 2  s .  co m*/
private void hideApplications() {
    if (mBlockAnimation) {
        return;
    }
    mBlockAnimation = true;

    mShowApplicationsCheck.toggle();

    if (mHideLayoutAnimation == null) {
        mHideLayoutAnimation = AnimationUtils.loadLayoutAnimation(this, R.anim.hide_applications);
    }

    mGridExit.setAnimationListener(new HideGrid());
    mGrid.startAnimation(mGridExit);
    mGrid.setVisibility(View.INVISIBLE);
    //        mShowApplications.requestFocus();

    // This enables a layout animation; if you uncomment this code, you need to
    // comment the line mGrid.startAnimation() above
    //        mGrid.setLayoutAnimationListener(new HideGrid());
    //        mGrid.setLayoutAnimation(mHideLayoutAnimation);
    //        mGrid.startLayoutAnimation();
}