v4.app.NotificationCompat 和 v7.app.NotificationCompat 有什么区别?
what is the difference between v4.app.NotificationCompat and v7.app.NotificationCompat?
我正在阅读 google official website for building Notification
上的教程
在执行代码时,我注意到 NotificationCompat 存在于支持库 V4 和 V7 中。
它们之间有什么区别?
它们中的任何一个是否有助于将通知推送到锁定屏幕?
请注意,在 API 级别 26 中弃用了 v7 NotificationCompat,并且 v4 有所扩展。如果你的compileSdk是26+,你必须使用v4.
如您在 the docs 中所见,v7 继承自 v4,然后添加了更多功能。
android.support.v7.app.NotificationCompat
An extension of NotificationCompat which supports NotificationCompat.MediaStyle. You should start using this variant if you need support for media styled notifications.
v7 可以做 v4 可以做的一切。唯一的区别是v7也支持.MediaStyle
,而v4不支持
关于锁屏,有一些常量定义了它们的工作方式,例如是否显示:
我正在阅读 google official website for building Notification
上的教程在执行代码时,我注意到 NotificationCompat 存在于支持库 V4 和 V7 中。
它们之间有什么区别?
它们中的任何一个是否有助于将通知推送到锁定屏幕?
请注意,在 API 级别 26 中弃用了 v7 NotificationCompat,并且 v4 有所扩展。如果你的compileSdk是26+,你必须使用v4.
如您在 the docs 中所见,v7 继承自 v4,然后添加了更多功能。
android.support.v7.app.NotificationCompat
An extension of NotificationCompat which supports NotificationCompat.MediaStyle. You should start using this variant if you need support for media styled notifications.
v7 可以做 v4 可以做的一切。唯一的区别是v7也支持.MediaStyle
,而v4不支持
关于锁屏,有一些常量定义了它们的工作方式,例如是否显示: