zoukankan      html  css  js  c++  java
  • android 通知栏 notifcation

      http://blog.csdn.net/guolin_blog/article/details/50945228  郭神的博客

    final NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
    final Notification notification = builder.setContentTitle("这是通知标题").setContentText("这是通知的内容").
    setWhen(System.currentTimeMillis()).setSmallIcon(R.mipmap.ic_launcher).setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher))
    .setColor(Color.parseColor("#EAA935")).build();


    final Notification notification2 = builder.setContentTitle("这是通知标题2").setContentText("这是通知的内容2").
    setWhen(System.currentTimeMillis()).setSmallIcon(R.mipmap.ic_launcher).setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher))
    .build();


    btn_notification = (Button) findViewById(R.id.btn_notification);
    btn_notification2 = (Button) findViewById(R.id.btn2);

    btn_notification.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
    manager.notify(1, notification);
    }
    });

    btn_notification2.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
    manager.notify(2, notification2);
    }
    });
  • 相关阅读:
    Spring Boot集成Spring Security
    vue全局使用axios的方法
    在SpringBoot 使用Redis存储Session
    SpringBoot几种定时任务的实现方式
    mysql重置auto_increment字段
    iView中DatePicker的表单验证问题
    go语言基础(四)
    go语言基础(三)
    go语言基础(二)
    go语言基础(一)
  • 原文地址:https://www.cnblogs.com/jeno-song/p/5542304.html
Copyright © 2011-2022 走看看