安卓(Android) 怎么实现由下而上的动画(Animation)

2019年10月15日20:58:53安卓(Android) 怎么实现由下而上的动画(Animation)已关闭评论 262 899字阅读2分59秒

1.简介

安卓(Android) 怎么实现由下而上的动画(Animation)?——请看下文。

2.示例代码

/**
 * 版权所有 编程十万个怎么办(www.tah1986.com)
 */



import android.view.animation.Animation;

import android.view.animation.LinearInterpolator;

import android.view.animation.TranslateAnimation;

public class Main {
    static public Animation outToBottomAnimation() {

        Animation outtoRight = new TranslateAnimation(

        Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT,
                0.0f,

                Animation.RELATIVE_TO_PARENT, 0.0f,
                Animation.RELATIVE_TO_PARENT, +1.0f

        );

        outtoRight.setDuration(900);

        outtoRight.setInterpolator(new LinearInterpolator());

        return outtoRight;

    }

    static public Animation outToBottomAnimation(long duration) {

        Animation outtoRight = new TranslateAnimation(

        Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT,
                0.0f,

                Animation.RELATIVE_TO_PARENT, 0.0f,
                Animation.RELATIVE_TO_PARENT, +1.0f

        );

        outtoRight.setDuration(duration);

        outtoRight.setInterpolator(new LinearInterpolator());

        return outtoRight;

    }
}

 
继续阅读
编程十万个怎么办