本文整理汇总了Java中android.view.animation.AlphaAnimation.setAnimationListener方法的典型用法代码示例。如果您正苦于以下问题:Java AlphaAnimation.setAnimationListener方法的具体用法?Java AlphaAnimation.setAnimationListener怎么用?Java AlphaAnimation.setAnimationListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.animation.AlphaAnimation
的用法示例。
在下文中一共展示了AlphaAnimation.setAnimationListener方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setImgBackGround
import android.view.animation.AlphaAnimation; //导入方法依赖的package包/类
private void setImgBackGround() {
String[] images = getResources().getStringArray(R.array.splash_background);
int position = new Random().nextInt(images.length - 1) % (images.length);
Glide.with(this)
.load(images[position])
.into(mImgBackGround);
String path = SpUtil.getString(this, "path");
Glide.with(this)
.load(path)
.asBitmap()
.error(R.drawable.def_avatar)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
mCircleImageView.setImageBitmap(resource);
}
});
//设置图像的透明度
AlphaAnimation animation = new AlphaAnimation(0.1f, 1.0f);
animation.setDuration(800);
mCircleImageView.startAnimation(animation);
animation.setAnimationListener(this);
}
示例2: fadeIn
import android.view.animation.AlphaAnimation; //导入方法依赖的package包/类
/**
* <p>对 View 做透明度变化的进场动画。</p>
* <p>相关方法 {@link #fadeOut(View, int, Animation.AnimationListener, boolean)}</p>
*
* @param view 做动画的 View
* @param duration 动画时长(毫秒)
* @param listener 动画回调
* @param isNeedAnimation 是否需要动画
*/
public static AlphaAnimation fadeIn(View view, int duration, Animation.AnimationListener listener, boolean isNeedAnimation) {
if (view == null) {
return null;
}
if (isNeedAnimation) {
view.setVisibility(View.VISIBLE);
AlphaAnimation alpha = new AlphaAnimation(0, 1);
alpha.setInterpolator(new DecelerateInterpolator());
alpha.setDuration(duration);
alpha.setFillAfter(true);
if (listener != null) {
alpha.setAnimationListener(listener);
}
view.startAnimation(alpha);
return alpha;
} else {
view.setAlpha(1);
view.setVisibility(View.VISIBLE);
return null;
}
}
示例3: animate
import android.view.animation.AlphaAnimation; //导入方法依赖的package包/类
private static void animate(View view, int duration, AnimationListener listener, float fromAlpha, float targetAlpha) {
// Create new animation
AlphaAnimation newAnimation = new AlphaAnimation(fromAlpha, targetAlpha);
newAnimation.setDuration(duration);
// Force fillAfter flag to be true
newAnimation.setFillAfter(true);
newAnimation.setAnimationListener(listener);
// Start fading
view.startAnimation(newAnimation);
}
示例4: getAlphaAnimation
import android.view.animation.AlphaAnimation; //导入方法依赖的package包/类
/**
* Gets a transparency gradient animation
*
* @param fromAlpha Transparency at the beginning
* @param toAlpha Transparency at the end
* @param durationMillis duration
* @param animationListener Animation monitor
* @return A transparency gradient animation
*/
public static AlphaAnimation getAlphaAnimation(float fromAlpha, float toAlpha, long durationMillis, Animation.AnimationListener animationListener) {
AlphaAnimation alphaAnimation = new AlphaAnimation(fromAlpha, toAlpha);
alphaAnimation.setDuration(durationMillis);
if (animationListener != null)
alphaAnimation.setAnimationListener(animationListener);
return alphaAnimation;
}
示例5: getAlphaAnimation
import android.view.animation.AlphaAnimation; //导入方法依赖的package包/类
/**
* 获取一个透明度渐变动画
*
* @param fromAlpha 开始时的透明度
* @param toAlpha 结束时的透明度都
* @param durationMillis 持续时间
* @param animationListener 动画监听器
* @return 一个透明度渐变动画
*/
public static AlphaAnimation getAlphaAnimation(float fromAlpha, float toAlpha, long durationMillis, AnimationListener animationListener) {
AlphaAnimation alphaAnimation = new AlphaAnimation(fromAlpha, toAlpha);
alphaAnimation.setDuration(durationMillis);
if (animationListener != null) {
alphaAnimation.setAnimationListener(animationListener);
}
return alphaAnimation;
}