Android Notification通知栏设计指南

泡在网上的日子 / 文 发表于2014-03-23 23:53 次阅读 Notification,android

android的通知系统就让用户在没有打开app的情况下也能接收来自app的消息,比如短信应用中有新的短信或者日历应用中有到期的日程。

Jelly Bean中的新特性

这些新特性包括:

1.允许用户在通知抽屉notification drawer中直接做出响应通知的动作。

2.notification的大小和布局比以前更灵活,可以展开通知查看更多的信息。

3.新增优先级标志位,以前优先级都是根据时间排序,现在你可以自己制定优先级。


一步一步解读Notification



基本布局

一个notification至少要有:

通知图标或者通知发送人的头像图标。

notification的标题和内容

notification的时间

当发送中的图片显示在前面时,一个表明是什么应用发送此通知的小图标

可展开的布局

Jelly Bean版本为通知提供了显示更多细节的可选项,更多信息可以是短消息的最开头几行或者一个预览图。用户可以挤压或者滑动两只手指展开或者收拢。android为notification提供了两种展开模式,一种是展开显示更多文字,一种是展开显示图片。



动作响应

从Jelly Bean开始,android支持在notification的底部提供响应按钮,用户不必进入发出这个通知的activity中就能对一个通知作出响应,这简化了交互过程,同时结合滑动删除特效给用户带来了很人性化的体验。但是到底放多少个这样的响应按钮需要考虑清楚,放的越多用户就会感到越复杂,将个数限制在最少范围了,无多大意义的响应按钮千万别堆上去。

可以考虑放入的响应:

非常重要的,明确典型的

对速度敏感,需要用户立即作出响应的

不会跟其他的响应按钮发生冲突

避免引入的响应:

模糊不清,用户不容易理解的

与默认响应重复的,比如打开或者查看,因为点开一条通知默认就是这些行为

日历日程的两个响应按钮


你可以最多引入三个响应按钮,每个按钮由图标和描述文字组成。将响应按钮加入一个基本布局的notification会让它变为可扩展的notification,即便他本身没有设置expanded layout。因为默认一个通知的响应按钮是隐藏的,因此你需要确保在相关应用内部这些响应按钮也能被关注到。


一些设计准则



notification的个性化

对那些能知道通知发送人notification而言,最好包含那个人的头像,同时记得在第二个图标的位置显示app的图标,一边让人一看便知这是谁发来的,是来自于哪个app。

将用户导向正确的地方


When the user touches the body of a notification (outside of the action buttons), open your app to the place where the user can consume and act upon the data referenced in the notification. In most cases this will be the detail view of a single data item such as a message, but it might also be a summary view if the notification is stacked (see Stacked notifications below) and references multiple items. If in any of those cases the user is taken to a hierarchy level below your app’s top-level, insert navigation into your app’s back stack to allow them to navigate to your app’s top level using the system back key. For more information, see the chapter on System-to-app navigation in the Navigation design pattern.

当用户点击通知的主体时(在动作按钮之外),打开你的应用程序到用户可以对通知中引用的数据进行查看以及采取动作的地方。在大多数情况下,这个地方是像信息一样的单项数据的详情视图, 但是如果已经积累了多条同类型的通知(参看下面的堆栈通知)的话,打开的也可能是概要视图。如果在任何这些情况下,用户被逮到你的应用程序顶层视图下级的视图中,在你的应用程序的back堆栈中Haruna导航以便允许用于使用系统返回(back)键来回到顶层视图。

CORRECTLY SET AND MANAGE NOTIFICATION PRIORITY

正确地设置和管理通知优先级

Starting with Jelly Bean, Android now supports a priority flag for notifications. It allows you to influence where your notification will appear in comparison to other notifications and help to make sure that users always see their most important notifications first. You can choose from the following priority levels when posting a notification:

从Jelly Bean开始,Android现在支持通知的优先级标记。优先级标记允许你影响你的通知相对于其他通知的显示位置,并且有助于确保用户总是首先看到最重要的通知。你可以在发送通知时从下面的优先级中进行选择:

STACK YOUR NOTIFICATIONS

堆积你的通知

If your app creates a notification while another of the same type is still pending, avoid creating an altogether new notification object. Instead, stack the notification.

如果你的应用程序在其他相同类型的通知仍然在待处理时产生了新的通知,避免产生新的通知对象。相反,堆积你的通知。

A stacked notification builds a summary description and allows the user to understand how many notifications of a particular kind are pending.

堆积的通知构建概要说明并且让用户知道待处理的特定类型通知的数目。



You can provide more detail about the individual notifications that make up a stack by using the expanded digest layout. This allows users to gain a better sense of which notifications are pending and if they are interesting enough to be read in detail within the associated app.

你可以提供更多关于独立通知的详情,这些详情通过使用扩展的摘要布局组成一个堆栈。这让用户更加清楚地了解哪些通知待处理,以及如果他们对此足够感兴趣那么他们就会在相关应用中进行详细的阅读。

MAKE NOTIFICATIONS OPTIONAL

让通知可选

Users should always be in control of notifications. Allow the user to disable your apps notifications or change their alert properties, such as alert sound and whether to use vibration, by adding a notification settings item to your application settings.

用户应该总是能够控制通知。通过在应用程序中添加通知设置选项来允许用户关闭通知功能或者改变通知的属性,例如通知的声音以及是否使用振动。

USE DISTINCT ICONS

使用不同的图标

By glancing at the notification area, the user should be able to discern what kinds of notifications are currently pending.

瞥一眼通知区域,用户就应该能够看清楚哪些类型的通知待处理。

Do
Look at the notification icons the Android apps already provide and create notification icons for your app that are sufficiently distinct in appearance.


看Android已经提供的通知图标,然后创建你的应用程序的通知图标,让它们的外观足够不同。

Do
Use the proper notification icon style for small icons, and the Holo Dark action bar icon style for your action icons.


对小图标使用合适的通知图标样式,并且对你的动作图标使用Holo Dark图标样式。

Do
Keep your icons visually simple and avoid excessive detail that is hard to discern.


保持你的图标视觉上的简单性,并避免难以分辨的过多细节。

Don’t
Use color to distinguish your app from others.

不要
使用颜色来区别图标。

PULSE THE NOTIFICATION LED APPROPRIATELY

合适地跳动通知LED

Many Android devices contain a tiny lamp, called the notification LED, which is used to keep the user informed about events while the screen is off. Notifications with a priority level of MAX, HIGH, or DEFAULT should cause the LED to glow, while those with lower priority (LOW and MIN) should not.

许多Android设备包含一个小灯,叫做通知LED,它用于在屏幕关闭时通知用户发生了相关事件。MAX、HIGH或者DEFAULT优先级的通知会让LED发光,而低优先级(LOW和MIN)的则不需要让LED发光。

The user’s control over notifications should extend to the LED. By default, the LED will glow with a white color. Your notifications shouldn’t use a different color unless the user has explicitly customized it.

用户对通知的控制应该扩展到LED。默认情况下,LED会显示白色。除非用户特别设定,你的通知不应该使用不同的颜色。

Building notifications that users care about

构建用户关心的通知


To create an app that feels streamlined, pleasant, and respectful, it is important to design your notifications carefully. Notifications embody your app’s voice, and contribute to your app’s personality. Unwanted or unimportant notifications can annoy the user, so use them judiciously.

为了创建让人感觉流畅、愉悦以及另外尊敬的应用程序,仔细地设计你的通知非常重要。通知体现了你的应用程序的声音,并且反映了你的应用的个性。不想要的或者不重要的通知会惹恼用户,所以需要明智地使用通知。

WHEN TO DISPLAY A NOTIFICATION

什么时候显示通知

To create an application that people love, it’s important to recognize that the user’s attention and focus is a resource that must be protected. While Android’s notification system has been designed to minimize the impact of notifications on the users attention, it is nonetheless still important to be aware of the fact that notifications are potentially interrupting the users task flow. As you plan your notifications, ask yourself if they are important enough to warrant an interruption. If you are unsure, allow the user to opt into a notification using your apps notification settings or adjust the notifications priority flag.

为了创建人们喜爱的应用程序,认识到用户的注意力是必须保护的非常重要。而Android的通知系统被设计成最小化通知对用户注意力的影响, 然而了解通知可能会打断用户的任务流程这个事实依然非常重要。在你计划通知时,问问你自己他们是否足够重要而有必要使用中断。如果你不确定,让用户使用你的应用程序通知设置或者调整通知优先级标记来进行选择。

While well behaved apps generally only speak when spoken to, there are some limited cases where an app actually should interrupt the user with an unprompted notification.

因为具有良好行为的应用程序通常只在需要时通知用户,有一些有限的情况,应用程序实际上应该使用一个不提示的通知中断用户。

Notifications should be used primarily for time sensitive events, and especially if these synchronous events involve other people. For instance, an incoming chat is a real time and synchronous form of communication: there is another user actively waiting on you to respond. Calendar events are another good example of when to use a notification and grab the user’s attention, because the event is imminent, and calendar events often involve other people.

通知应该主要用于时间敏感的事件,尤其是如果这些同步事件涉及到其他人。例如,一个接收到的聊天是实时并且同步形式的通讯方式:那里有另外一个用户正在等待你的反馈。日历时间是另外一个很好的例子,当用于通知并且抓住了用户的注意力时,因为事件即将发生,并且日历时间经常和其他人相关。

WHEN NOT TO DISPLAY A NOTIFICATION

什么时候不要显示通知

There are however many other cases where notifications should not be used:

然而有很多其他例子不应该使用通知:

1. Avoid notifying the user of information that is not directed specifically at them, or information that is not truly time sensitive. For instance the asynchronous and undirected updates flowing through a social network generally do not warrant a real time interruption. For the users that do care about them, allow them to opt-in.1. 避免通知用户不直接针对他们的信息,或者哪些不是时间敏感的信息。例如社交网络中异步的和非直接的更新流通常不用实时的中断。对于不关心它们的用户,允许他们选择。2. Don't create a notification if the relevant new information is currently on screen. Instead, use the UI of the application itself to notify the user of new information directly in context. For instance, a chat application should not create system notifications while the user is actively chatting with another user.2. 如果相关的新信息已经显示在屏幕上,则不需要创建通知。相反,使用应用程序自己的界面来直接通知用户新的信息。例如,一个聊天程序在用户和其他用户聊天时不应该创建系统通知。3. Don't interrupt the user for low level technical operations, like saving or syncing information, or updating an application, if it is possible for the system to simply take care of itself without involving the user.3. 不要为了低级别的技术操作打断用户,像保存或者信息同步,或者更新应用程序,如果可能的话系统应该无需用户介入而自己进行简单的处理。4. Don't interrupt the user to inform them of an error if it is possible for the application to quickly recover from the error on its own without the user taking any action.4. 不要为了通知用户错误而打断用户,如果可能的话,应用程序应该自行地从错误中快速恢复,而不需要用户采取任何动作。5. Don't create notifications that have no true notification content and merely advertise your app. A notification should inform the user about a state and should not be used to merely launch an app.5. 不要创建没有真正内容的通知,那样只不过是为你的应用程序做广告。通知应该通知用户关于状态的信息而不应该仅仅用来启动应用程序。6. Don't create superfluous notifications just to get your brand in front of users. Such notifications will only frustrate and likely alienate your audience. The best way to provide the user with a small amount of updated information and to keep them engaged with your application is to develop a widget that they can choose to place on their home screen.6. 不要只是而为了把你的品牌带到用户面前而创建多余的通知。这样的通知只会让用户失望,并且可能会疏远你的用户。最佳的方式是开发一个用户可以选择放置到桌面的widget,它只提供给用户少量的更新信息,用户可以选择将它们放到桌面。

Interacting With Notifications

和通知进行交互


Notifications are indicated by icons in the notification area and can be accessed by opening the notification drawer.

通知通过通知区域的图标来表示,并且可以通过打开通知栏来访问。

Inside the drawer, notifications are chronologically sorted with the latest one on top. Touching a notification opens the associated app to detailed content matching the notification. Swiping left or right on a notification removes it from the drawer.

在通知栏中,通知以最新的在最顶的方式排序。点击通知会打开相关的App来显示与之匹配的详细内容。向左或者向右滑动通知会从通知栏删除通知。

ONGOING NOTIFICATIONS

不间断的通知

Ongoing notifications keep users informed about an ongoing process in the background. For example, music players announce the currently playing track in the notification system and continue to do so until the user stops the playback. They can also be used to show the user feedback for longer tasks like downloading a file, or encoding a video. Ongoing notifications cannot be manually removed from the notification drawer.

不间断的通知保持通知用户关于后台正在进行的处理。例如,在通知系统中的音乐播放器告诉用户当前播放的音轨,直到用户停止播放都会一直这样。不间断的通知不能从通知栏手动删除。

DIALOGS AND TOASTS ARE FOR FEEDBACK NOT NOTIFICATION

对话框和TOAST是为了反馈而不是通知

Your app should not create a dialog or toast if it is not currently on screen. Dialogs and Toasts should only be displayed as the immediate response to the user taking an action inside of your app. For further guidance on the use of dialogs and toasts, refer to Confirming & Acknowledging.

在你的应用程序没有显示在屏幕上时,不应该创建对话框或者toast。对话框和toast应该只在用户在你的应用程序中采取行动时显示。关于对话框和toast的更多指引,可参考Confirming & Acknowledging



收藏 赞 (5) 踩 (0)
上一篇:Android Notification通知栏开发详解
Notification 是在你的应用常规界面之外展示的消息。当 app 让系统发送一个消息的时候,消息首先以图表的形式显示在通知栏。要查看消息的详情需要进入通知抽屉 ( notification drawer ) 中查看。通知栏和通知抽屉 ( notification drawer ) 都是系统层面控制
下一篇:android 加载器loader详解
Loaders loader在android 3.0之后才被引入,它简化了在activity和fragment中异步加载数据的步骤(个人认为简化是次要的,更重要的是优雅的实现了异步加载),loader有如下特点: 适用于每个activity和fragment 提供异步加载的实现方法 监听数据源的一举一动