国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

安卓之通知欄

2019-11-07 23:53:51
字體:
來源:轉載
供稿:網友

通知欄,這個很好理解吧,不理解的加QQ592977585。 主要class:NotificationCompat(通知欄),然后在給它設置參數。根據你的需要來設置,再通知管理器 NotificationManager發送通知。一個簡單的通知欄就完成了。它自帶左右拖動可以清除。 直接上代碼:

public class RingActivity extends AppCompatActivity { PRivate MediaPlayer mediaPlayer; private PendingIntent pendingIntent; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ring); //顯示通知欄 NotificationCompat.Builder notificationCompat=new NotificationCompat.Builder(this); //設置參數 notificationCompat.setDefaults(NotificationCompat.DEFAULT_ALL); notificationCompat.setContentTitle("鬧鐘"); notificationCompat.setContentText("一大波僵尸正在來襲"); notificationCompat.setSmallIcon(android.R.drawable.ic_lock_idle_alarm); Intent intent=new Intent(RingActivity.this,RingActivity.class); pendingIntent = PendingIntent.getBroadcast(RingActivity.this,0x101,intent,0); //notificationCompat.setDeleteIntent(pendingIntent); notificationCompat.setContentIntent(pendingIntent); Notification notification=notificationCompat.build(); //通知管理器 NotificationManager notificationManager= (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); //發送通知 notificationManager.notify(0x101,notification); }} $(function () { $('pre.prettyprint code').each(function () { var lines = $(this).text().split('/n').length; var $numbering = $('').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 吉木萨尔县| 合肥市| 永善县| 西林县| 霍林郭勒市| 马关县| 虎林市| 灵山县| 阿合奇县| 青州市| 昭苏县| 阿荣旗| 建昌县| 岳普湖县| 修水县| 莲花县| 舞阳县| 尼木县| 塔河县| 铜鼓县| 清流县| 安多县| 安溪县| 渑池县| 涿鹿县| 西青区| 舟曲县| 和政县| 临泽县| 西青区| 库伦旗| 辽宁省| 井研县| 五台县| 崇义县| 驻马店市| 巍山| 平潭县| 东乡族自治县| 江达县| 东莞市|