AlphaAnimation图片闪烁
作者:互联网
需求背景 : 当轮胎压力过大时,轮胎变红并且闪烁
// 开始闪烁时调用
private void startFlash(ImageView iv) {
iv.setVisibility(View.VISIBLE);
AlphaAnimation animation = new AlphaAnimation(1, 0);
animation.setDuration(1000);
animation.setRepeatCount(-1);
iv.setAnimation(animation);
animation.start();
}
// 停止闪烁时调用
private void stopFlash(ImageView iv) {
iv.setVisibility(View.INVISIBLE);
iv.clearAnimation();
}
标签:setVisibility,private,iv,animation,AlphaAnimation,闪烁,图片 来源: https://blog.csdn.net/qq_44203816/article/details/121890476