Notification 的一些配置
- setContentTitle 消息题目(位于第一行)
- setContentText 消息文本(位于第二行)
- setSmallIcon 通知布局中使用的小图标(必须提供)
- setContentIntent 在点击通知时发送的意图
- setLargeIcon 设置显示在提示和通知中的大图标
- setAutoCancel 在通知栏点击我们定义的通知是否自动取消显示
- 应用名称和时间戳 由系统提供
- setWhen() 设置通知时间
- setShowWhen(false) 隐藏通知时间
- setSound() 设置自定义音乐
- setStyle() 设置通知样式
- setPriorty() 设置通知优先级
- setDefault() 设置通知的默认设置
下面是定义和使用Notification 的代码
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private Context mContext;
private NotificationManager mNManager;
private Notification notify1;
Bitmap LargeBitmap = null;
private static final int NOTIFYID_1 = 1;
private Button btn_show_normal;
private Button btn_close_normal;
@Override
protected void onCreate(Bundle savedInstan