show Empty View Animation - Android Animation

Android examples for Animation:Animation to Show

Description

show Empty View Animation

Demo Code


//package com.java2s;
import android.content.Context;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;

public class Main {
    public static void showEmpty(Context activity, boolean show,
            View emptyView) {/*from w ww.j a  v a 2s . c om*/
        if (emptyView != null) {

            Animation anim = AnimationUtils
                    .loadAnimation(activity, show ? android.R.anim.fade_in
                            : android.R.anim.fade_out);
            if (show
                    && (emptyView.getVisibility() == View.GONE || emptyView
                            .getVisibility() == View.INVISIBLE)) {
                emptyView.setAnimation(anim);
                emptyView.setVisibility(View.VISIBLE);
            } else if (!show && emptyView.getVisibility() == View.VISIBLE) {
                emptyView.setAnimation(anim);
                emptyView.setVisibility(View.GONE);
            }
        }
    }
}

Related Tutorials