Android应用中怎么实现通知栏闪动效果-创新互联

Android应用中怎么实现通知栏闪动效果?相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。

成都创新互联专注于宁国网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供宁国营销型网站建设,宁国网站制作、宁国网页设计、宁国网站官网定制、微信小程序定制开发服务,打造宁国网络公司原创品牌,更为您提供宁国网站排名全网营销落地服务。

显示通知代码:

private void showNotification(Context ctx, String url) {
    Notification n = new Notification();
    n.flags |= Notification.FLAG_SHOW_LIGHTS;
    n.flags |= Notification.FLAG_AUTO_CANCEL;
    n.defaults = Notification.DEFAULT_SOUND;
    n.icon = R.drawable.ic_launcher;
    n.when = System.currentTimeMillis();
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setClassName(ctx.getPackageName(), MainActivity.class.getName());
    PendingIntent pi = PendingIntent.getActivity(ctx, 0, intent, 0);
    n.setLatestEventInfo(ctx, "title", "summary", pi);
    NotificationManager manager = (NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE);
    manager.notify(0, n);
}

分享名称:Android应用中怎么实现通知栏闪动效果-创新互联
新闻来源:https://www.cdcxhl.com/article30/dsohpo.html

成都网站建设公司_创新互联,为您提供App设计App开发搜索引擎优化网站维护虚拟主机网站设计

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

手机网站建设