程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> JAVA編程 >> 關於JAVA >> java圖形界面編程之模仿血壓計

java圖形界面編程之模仿血壓計

編輯:關於JAVA

java圖形界面編程之模仿血壓計。本站提示廣大學習愛好者:(java圖形界面編程之模仿血壓計)文章只能為提供參考,不一定能成為您想要的結果。以下是java圖形界面編程之模仿血壓計正文


已經碰到過如許的成績,在我的代碼中應用了告訴欄,一切都正常,然則就是正在停止的告訴欄中屬於我的法式的那一條老是高低跳來跳去,一閃一閃的。感到用戶體驗很欠好,因而Google一下,找到懂得決辦法。

在我的代碼,我是如許寫的。


notification.when = System.currentTimeMillis();

這就是成績的症結,關於告訴來講,when這個屬性值應當在activity一啟動的時刻就應當固定。假如沒有固定,就會應用默許的值,默許的值就是以後的時光,即System.currentTimeMillis()的值。是以應用一個自界說的固定值便可以處理成績。


final long TIMESTAMP_FIXED = 1234567890l;
notification.when = TIMESTAMP_FIXED;

以下如Google引見若何應用notification的when的解釋。


A timestamp related to this notification, in milliseconds since the epoch. Default value: Now. Choose a timestamp that will be most relevant to the user. For most finite events, this corresponds to the time the event happened (or will happen, in the case of events that have yet to occur but about which the user is being informed). Indefinite events should be timestamped according to when the activity began. Some examples:

Notification of a new chat message should be stamped when the message was received.
Notification of an ongoing file download (with a progress bar, for example) should be stamped when the download started.
Notification of a completed file download should be stamped when the download finished.
Notification of an upcoming meeting should be stamped with the time the meeting will begin (that is, in the future).
Notification of an ongoing stopwatch (increasing timer) should be stamped with the watch's start time.
Notification of an ongoing countdown timer should be stamped with the timer's end time.

Reference

http://developer.android.com/reference/android/app/Notification.html#when

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved