Android Notification.Builder与NotificationCompat.Builder [英] Android Notification.Builder vs NotificationCompat.Builder

查看:86
本文介绍了Android Notification.Builder与NotificationCompat.Builder的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为Android通知看到的几乎所有示例代码似乎都使用NotificationCompat.我已经使用Notification.Builder编写了自己的代码.对我来说,尚不清楚使用NotificationCompat.Builder有什么好处(如果有的话).我希望这里的人能够解释这些差异.

Pretty much all the bits of sample code I see for Android notififactions appear to use NotificationCompat. I have written up my own code using Notification.Builder. It is not clear to me what benefits, if any, there might be in using NotificationCompat.Builder. I hope that someone here might be able to explain the differences.

推荐答案

您可以使用NotificationCompat.Builder#setLargeIcon(Bitmap)之类的东西,使您可以充分利用Android 3.0+和大图标之类的东西,同时保持不支持此类功能的3.0之前的Android版本具有兼容性.

You can use things like NotificationCompat.Builder#setLargeIcon(Bitmap) to allow you to take full advantage of Android 3.0+ with things like the large icon, while maintaining compatibility on versions of Android prior to 3.0 that do not support such things.

这篇关于Android Notification.Builder与NotificationCompat.Builder的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆