private void setFlickerAnimation(ImageView iv_chat_head) {
final Animation animation = new AlphaAnimation(1, 0);
animation.setDuration(500); //设置动画所用的时间
animation.setInterpolator(new LinearInterpolator()); //设置动画
animation.setRepeatCount(Animation.INFINITE); //设置重复次数,INFINITE为无限
animation.setRepeatMode(Animation.REVERSE); //设置重复模式,RESTART为结束后重新开始,REVERSE为按原来的轨迹逆向返回
iv_chat_head.setAnimation(animation); //开始执行动画
}
获取ImageView的对象后,setFlickerAnimation就可以了