设置通知

请使用 config.xmlintegers.xml 中提供的设置来设置通知的外观和配置。

外观

如需配置通知的外观,请在 config.xml 中修改以下设置:

用途 设置
以提醒式通知的形式显示导航。 config_showNavigationHeadsup
默认:true
为名为
Notification.CATEGORY_NAVIGATION 的类别指定通知卡的背景颜色
config_enableCardBackgroundColorForCategoryNavigation
默认:false
从系统应用设置通知卡的背景颜色。 config_enableCardBackgroundColorForSystemApp
默认:false
在通知列表顶部显示通知标头。 config_showHeaderForNotifications
默认:false
在通知列表底部显示通知脚注。 config_showFooterForNotifications
默认:true
更改小图标的强调色。 config_enableSmallIconAccentColor
默认:true

功能

如需配置通知的运行方式,请在 integers.xml 中更新以下设置:

用途 设置
设置展开通知组时显示的群组成员的数量上限。 max_group_children_number
默认:8
指定浮动通知的持续时间(以毫秒为单位)。此持续时间到期后,系统会自动关闭浮动通知,直至设置了以下标志的现有浮动通知发生更新:

Notification.FLAG_ONLY_ALERT_ONCE

收到更新后,系统会重置时间,并延长该浮动通知的显示时间。如果设置了此标志,在收到更新后,系统就不会重置时间。
headsup_notification_duration_ms
默认:8000
设置浮动通知的最短显示时间(以毫秒为单位)。当应用在发布时或配置的持续时间内取消通知时,系统至少会在此时间内显示浮动通知。 heads_up_notification_minimum_time
默认:2000
指定“飞入”动画显示浮动通知所需的总持续时间(以毫秒为单位)。 headsup_total_enter_duration_ms
默认:233
设置“飞入”动画显示 Alpha 版浮动通知所需的时间(以毫秒为单位)。在动画显示期间,浮动通知从透明状态转换到不透明状态所需的时间。 headsup_alpha_enter_duration_ms
默认:83
指定“飞出”动画显示浮动通知所需的时间(以毫秒为单位)。 headsup_exit_duration_ms
默认:150

定义用于确定滑动是向着同一方向的最小速度(以每秒像素为单位)。

min_velocity_for_swipe_direction_detection
默认:50