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应用中怎么实现通知栏闪动效果-创新互联
本文URL:http://www.scyingshan.cn/article/dsohpo.html

 建站
建站
 咨询
咨询 售后
售后
 建站咨询
建站咨询 
 