invisible View Animation - Android User Interface

Android examples for User Interface:View Animation

Description

invisible View Animation

Demo Code

/*// w  w w .  ja  v a  2  s  .  c om
 * *
 *  * Copyright 2012 fenbi.com. All rights reserved.
 *  * FENBI.COM PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 */
//package com.java2s;

import android.view.View;

import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;

public class Main {
    private static long ANIMATE_DURATION = 200;

    public static View invisibleView(View v, boolean animate) {
        if (v != null) {
            v.setVisibility(View.INVISIBLE);
            if (animate) {
                Animation ani = new AlphaAnimation(1f, 0f);
                ani.setDuration(ANIMATE_DURATION);
                v.startAnimation(ani);
            }
        }
        return v;
    }
}

Related Tutorials