一、所使用的技术:AlphaAnimation动画
1.官方描述:
An animation that controls the alpha level of an object. Useful for fading things in and out. This animation ends up changing the alpha property of a Transformation
即:控制对象alpha水平的动画。这个动画可以通过改变alpha属性,达到渐进渐出的效果。
2.构造方法:AlphaAnimation(float fromAlpha, float toAlpha)
官方解释:Constructor to use when building an AlphaAnimation from code
即:使用代码实现渐变动画
如:AlphaAnimation(0.01f, 1.0f); 从0.01f到1.0f渐变。学过flash的,应该对alpha值很了解,0.0是完全透明,1.0完全不透明。
二、动画的实现
1.实例化对象
AlphaAnimation anim = new AlphaAnimation(0.01f, 1.0f);
2.设置动画持续时长(两秒)
anim.setDuration(2000);
3.添加事件监听
anim.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
//渐变动画结束后,执行此方法,跳转到主界面
}
});
4。为控件绑定动画效果
imageView.setAnimation(anim);
5。开始动画
anim.start();
1.官方描述:
An animation that controls the alpha level of an object. Useful for fading things in and out. This animation ends up changing the alpha property of a Transformation
即:控制对象alpha水平的动画。这个动画可以通过改变alpha属性,达到渐进渐出的效果。
2.构造方法:AlphaAnimation(float fromAlpha, float toAlpha)
官方解释:Constructor to use when building an AlphaAnimation from code
即:使用代码实现渐变动画
如:AlphaAnimation(0.01f, 1.0f); 从0.01f到1.0f渐变。学过flash的,应该对alpha值很了解,0.0是完全透明,1.0完全不透明。
二、动画的实现
1.实例化对象
AlphaAnimation anim = new AlphaAnimation(0.01f, 1.0f);
2.设置动画持续时长(两秒)
anim.setDuration(2000);
3.添加事件监听
anim.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
//渐变动画结束后,执行此方法,跳转到主界面
}
});
4。为控件绑定动画效果
imageView.setAnimation(anim);
5。开始动画
anim.start();