我在android中玩通知,我想知道为什么notificationcompat没有像在果冻(见图片)中那样在姜饼中显示大图标和数字,我以为它就是为了这个目的而创建的?
以下是我如何启动通知:

    @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Button btnShow = (Button)findViewById(R.id.btnNotif);

    Intent intent = new Intent(this, NotificationReceiverActivity.class);
    PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);

    notificationManager =  (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);


        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
        .setWhen(System.currentTimeMillis())
        .setContentText("You are near your point of interest.")
        .setContentTitle("Proximity Alert!")
        .setSmallIcon(android.R.drawable.ic_menu_info_details)
        .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.orchide))
        .setAutoCancel(true)
        .setTicker("Proximity Alert!")
        .setNumber(10)
        .setContentIntent(pIntent)
        .setDefaults(Notification.DEFAULT_LIGHTS| Notification.DEFAULT_VIBRATE| Notification.DEFAULT_SOUND);
        /*Create notification with builder*/
         notification=notificationBuilder.build();

        /*sending notification to system.Here we use unique id (when)for making different each notification
         * if we use same id,then first notification replace by the last notification*/
    btnShow.setOnClickListener(new OnClickListener(){

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            notificationManager.notify(1000, notification);
        }

    });



}

最佳答案

在预蜂窝式API级别上忽略大图标。
NotificationCompat.Builder documentation说:
…在不提供扩展通知的平台版本上,依赖于扩展通知的方法无效…
如果您查看notificationcompat.builder源代码,您将看到用于Honeycomb和更高版本的大图标。

09-27 15:38