Android Notification通知欄設計指南
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。