日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

android 通知 可横幅展示的哦

發(fā)布時間:2024/1/8 编程问答 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 android 通知 可横幅展示的哦 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

找了好多個資源都不能橫幅展示用,終于弄出來了!老鐵們記得開啟通知橫幅權限。

NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);NotificationCompat.Builder notifyBuilder =new NotificationCompat.Builder( this ).setContentTitle( "title" ).setContentText( "ContentText" ).setSmallIcon( R.drawable.icon )// 點擊消失.setAutoCancel( true )// 設置該通知優(yōu)先級.setPriority( Notification.PRIORITY_MAX ).setLargeIcon( BitmapFactory.decodeResource( this.getResources(), R.drawable.icon ) ) // .setTicker( mTicker )// 通知首次出現在通知欄,帶上升動畫效果的.setWhen( System.currentTimeMillis() )// 通知產生的時間,會在通知信息里顯示// 向通知添加聲音、閃燈和振動效果的最簡單、最一致的方式是使用當前的用戶默認設置,使用defaults屬性,可以組合:.setDefaults( Notification.DEFAULT_VIBRATE | Notification.DEFAULT_ALL | Notification.DEFAULT_SOUND );Intent XuanIntent = new Intent();XuanIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);XuanIntent.setClass(this, MainActivity.class);PendingIntent resultPendingIntent =PendingIntent.getActivity( this, 0, XuanIntent, PendingIntent.FLAG_UPDATE_CURRENT );notifyBuilder.setContentIntent( resultPendingIntent );mNotificationManager.notify( 0, notifyBuilder.build() );

?

總結

以上是生活随笔為你收集整理的android 通知 可横幅展示的哦的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。