public static final class Notification.CarExtender
extends Object implements Notification.Extender
| java.lang.Object | |
| ↳ | android.app.Notification.CarExtender |
Helper类将Android Auto扩展添加到通知。 使用附加车辆信息创建通知:
Notification.Builder, setting any desired properties. Notification.CarExtender. add and set methods of Notification.CarExtender. extend(Notification.Extender) to apply the extensions to a notification.
Notification notification = new Notification.Builder(context)
...
.extend(new CarExtender()
.set*(...))
.build();
通过使用 CarExtender(Notification)构造函数,然后使用 get方法访问值,可以在现有通知上访问车辆扩展。
Nested classes |
|
|---|---|
class |
Notification.CarExtender.Builder |
class |
Notification.CarExtender.UnreadConversation 一个保存来自对话的未读消息的类。 |
Public constructors |
|
|---|---|
Notification.CarExtender() 使用默认选项创建一个 |
|
Notification.CarExtender(Notification notif) 从现有通知的CarExtender选项创建一个 |
|
Public methods |
|
|---|---|
Notification.Builder |
extend(Notification.Builder builder) 将车辆扩展应用于正在构建的通知。 |
int |
getColor() 获取重音颜色。 |
Bitmap |
getLargeIcon() 获取本车通知中使用的大图标,如果没有设置图标,则返回null。 |
Notification.CarExtender.UnreadConversation |
getUnreadConversation() 返回此通知传送的未读对话。 |
Notification.CarExtender |
setColor(int color) 设置Android Auto提示通知时使用的重音颜色。 |
Notification.CarExtender |
setLargeIcon(Bitmap largeIcon) 设置汽车通知的大图标。 |
Notification.CarExtender |
setUnreadConversation(Notification.CarExtender.UnreadConversation unreadConversation) 在消息通知中设置未读对话。 |
Inherited methods |
|
|---|---|
java.lang.Object
|
|
android.app.Notification.Extender
|
|
Notification.CarExtender ()
使用默认选项创建一个 Notification.CarExtender 。
Notification.CarExtender (Notification notif)
从现有通知的CarExtender选项创建一个 Notification.CarExtender 。
| Parameters | |
|---|---|
notif |
Notification: The notification from which to copy options. |
Notification.Builder extend (Notification.Builder builder)
将车辆扩展应用于正在构建的通知。 这通常由extend(Notification.Extender)方法Notification.Builder 。
| Parameters | |
|---|---|
builder |
Notification.Builder: the builder to be modified. |
| Returns | |
|---|---|
Notification.Builder |
the build object for chaining. |
Bitmap getLargeIcon ()
获取本车通知中使用的大图标,如果没有设置图标,则返回null。
| Returns | |
|---|---|
Bitmap |
The large icon for the car notification. |
也可以看看:
Notification.CarExtender.UnreadConversation getUnreadConversation ()
返回此通知传送的未读对话。
| Returns | |
|---|---|
Notification.CarExtender.UnreadConversation |
|
Notification.CarExtender setColor (int color)
设置Android Auto提示通知时使用的重音颜色。 Android Auto使用与setColor(int)一起设置的颜色强调显示的通知。 然而,在汽车环境中并非所有颜色都可以接受。 在这种情况下,此方法可用于覆盖通知中提供的颜色。
| Parameters | |
|---|---|
color |
int
|
| Returns | |
|---|---|
Notification.CarExtender |
|
Notification.CarExtender setLargeIcon (Bitmap largeIcon)
设置汽车通知的大图标。 如果扩展器中没有设置大图标,Android Auto会显示setLargeIcon(android.graphics.Bitmap)指定的图标
| Parameters | |
|---|---|
largeIcon |
Bitmap: The large icon to use in the car notification. |
| Returns | |
|---|---|
Notification.CarExtender |
This object for method chaining. |
Notification.CarExtender setUnreadConversation (Notification.CarExtender.UnreadConversation unreadConversation)
在消息通知中设置未读对话。
| Parameters | |
|---|---|
unreadConversation |
Notification.CarExtender.UnreadConversation: The unread part of the conversation this notification conveys. |
| Returns | |
|---|---|
Notification.CarExtender |
This object for method chaining. |