<--!创建xml文件-->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:background="@drawable/speaker_back_network" >
<ImageView
android:id="@+id/test2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/app_name"
android:src="@drawable/speaker_network" />
</LinearLayout>
图片闪烁的方法:
private void setFlickerAnimation(ImageView iv_chat_head) {
final Animation animation = new AlphaAnimation(1, 0);
animation.setDuration(750);//闪烁时间间隔
animation.setInterpolator(new AccelerateDecelerateInterpolator());
animation.setRepeatCount(Animation.INFINITE);
animation.setRepeatMode(Animation.REVERSE);
iv_chat_head.setAnimation(animation);
}
调用:
setFlickerAnimation((ImageView) view.findViewById(R.id.test2));