你如何用按钮显示大的消息?

时间:2015-05-04 14:46:39

标签: java android statusbar

我要做的是用至少一个按钮发出重要通知(如果我想假设至少有2个,我会接受)。

public void notification() {



   notification = new NotificationCompat.Builder(this);
   notification.setStyle(new NotificationCompat.BigTextStyle(notification)
   .bigText("lololololololoolololooloololoolooolloll")
   .setBigContentTitle("Big Title")
   .setSummaryText("Big Summary"))
   //.setContentTitle("Title")
   //.setContentText("Summary")
   //.setTicker("Idk what this is really...")
   .setDefaults(Notification.DEFAULT_ALL)
   .setSmallIcon(R.drawable.holo_pressed_blue);


    //vibrates when notification comes up
    Notification note = notification.build();
   note.defaults |= Notification.DEFAULT_VIBRATE;


   manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
   manager.notify(0, notification.build());

此外,如果它没有太大的麻烦,通过一个小通知,您如何将通知保留在状态栏中,并且它不允许用户将其从状态栏中删除,除非在应用程序中进行操作?