现在的位置: 首页 > 综合 > 正文

android.app.Notification.Notification(int icon, CharSequence tickerText, long when)翻译

2018年03月20日 ⁄ 综合 ⁄ 共 1221字 ⁄ 字号 评论关闭

定义Notification通知事件。

android.app.Notification.Notification(int icon, CharSequence tickerText, long when)

 

public Notification (int icon, CharSequence tickerText, long when)

Since: API Level 1

 

This constructor is deprecated.

Use Notification.Builder instead.

 

Constructs a Notification object with the information needed to have a status bar icon without the standard expanded view.

构建一个非标准的扩展视图,需要一个状态栏图标。

 

Parameters

icon  The resource id of the icon to put in the status bar.

tickerText  The text that flows by in the status bar when the notification first activates.

when  The time to show in the time field. In the System.currentTimeMillis timebase.

例如:

String tickerText = getString(R.string.imcoming_message_ticker_text, message);

Notification notif = new Notification(R.drawable.stat_sample, tickerText,

                System.currentTimeMillis());

再例如:

// Set the icon, scrolling text and timestamp.

// Note that in this example, we pass null for tickerText.  We update the icon enough that

// it is distracting to show the ticker text every time it changes.  We strongly suggest

// that you do this as well.  (Think of of the "New hardware found" or "Network connection

// changed" messages that always pop up)

//注意在这个例子中我们只是更新ICON图标,而不显示文字提示,我们强烈建议你这样做!!!因为考虑到类似有

//"找到新硬件"或“网络连接改变”这样的消息经常弹出来,怕影响他们。

Notification notification = new Notification(moodId, null, System.currentTimeMillis());

抱歉!评论已关闭.