为图片添加闪烁效果,java代码如下:
private void setFlickerAnimation(ImageView iv_chat_head) {
final Animation animation = new AlphaAnimation(1, 0); // Change alpha from fully visible to invisible
animation.setDuration(500); // duration - half a second
animation.setInterpolator(new LinearInterpolator()); // do not alter animation rate
animation.setRepeatCount(Animation.INFINITE); // Repeat animation infinitely
animation.setRepeatMode(Animation.REVERSE); //
iv_chat_head.setAnimation(animation);
}
本文介绍了一段使用Java实现图片闪烁效果的代码。通过AlphaAnimation改变透明度,使ImageView中的图片达到闪烁的效果。动画设置为无限循环播放,并在每次循环结束时反转动画。
735

被折叠的 条评论
为什么被折叠?



