糖尿病康复,内容丰富有趣,生活中的好帮手!
糖尿病康复 > android+图标闪烁动画 如何在android中闪烁通知图标? [DONE]

android+图标闪烁动画 如何在android中闪烁通知图标? [DONE]

时间:2020-03-07 17:51:33

相关推荐

android+图标闪烁动画 如何在android中闪烁通知图标? [DONE]

我找到了解决方案:我创建了动画文件并设置了该文件,感谢我找到了解决方案

SET FILE名称在这里: –

int icon = R.drawable.animationfile;

long when = System.currentTimeMillis();

notificationManager = (NotificationManager) context

.getSystemService(Context.NOTIFICATION_SERVICE);

Notification notification = new Notification(icon, "Your location is tracing", when);

String title = context.getString(R.string.app_name);

Intent notificationIntent = new Intent(context, Home.class);

// set intent so it does not start a new activity

notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);

PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent, 0);

notification.setLatestEventInfo(context, title, "Rohit", intent);

//notification.flags |= Notification.FLAG_AUTO_CANCEL;

notification.flags |= Notification.FLAG_SHOW_LIGHTS;

notification.flags |= Notification.FLAG_NO_CLEAR;

notification.defaults = Notification.DEFAULT_ALL;

notificationManager.notify(NOTIFICATION, notification);

我创建了这个文件

animationfile.xml:

xmlns:android="/apk/res/android"

android:oneshot="false">

如果觉得《android+图标闪烁动画 如何在android中闪烁通知图标? [DONE]》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。