使用的是Andriod API 26,Android Studio,在模拟器安卓8.0的手机上运行跟着郭霖大神的《第一行代码》中8.2.1的通知的基本用法来写的只有一个main_layout.xml,和MainActivity是我修改过代码的想弄出点击一下按钮后在通知栏出现通知出现的问题是:点击了按钮后,在通知栏没有出现通知main_layout.xml如下所示:<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">    <Button
        android:id="@+id/send_notice"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Send notice"/>
</LinearLayout>
MainActivity如下所示:
package com.example.notificationtest;import android.app.Notification;
import android.app.NotificationManager;import android.graphics.BitmapFactory;import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.app.NotificationCompat;
import android.util.Log;
import android.view.View;
import android.widget.Button;public class MainActivity extends AppCompatActivity implements View.OnClickListener{    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button sendNotice = (Button) findViewById(R.id.send_notice);
        sendNotice.setOnClickListener(this);
    }    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.send_notice:
                NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
                Notification notification = new NotificationCompat.Builder(this)
                        .setContentTitle("This is content title")
                        .setContentText("This is content test")
                        .setWhen(System.currentTimeMillis())
                        .setSmallIcon(R.mipmap.ic_launcher)
                        .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher))
                        .build();
                manager.notify(1, notification);
                Log.d("MainActivity", "test");
                break;
            default:
                break;
        }
    }
}点击按钮后,没有相应的通知,小白找不到解决方法,请求大神解答,谢谢!