Android 使用大号的通知
来源:互联网 发布:从笔记本cpu编号知型号 编辑:程序博客网 时间:2024/04/27 14:24
Notification 一般是两个形式出现的:
一种是普通形式
一种是bigView形式:
但是 big View 只在Notification扩展的时候显示,也就是说, 只在 此Notification 在drawer的最上面,或者是用户点击之后,才会扩展。
使用 BigView 的目的在于,让用户不需要打开 应用,就可以完成交互
构造一个Bigview (闹钟样例)
构造 忽略 和 稍后 两个将会出现在 bigview中的按钮
Intent dismissIntent = new Intent(this, PingService.class);dismissIntent.setAction(CommonConstants.ACTION_DISMISS);PendingIntent piDismiss = PendingIntent.getService(this, 0, dismissIntent, 0);Intent snoozeIntent = new Intent(this, PingService.class);snoozeIntent.setAction(CommonConstants.ACTION_SNOOZE);PendingIntent piSnooze = PendingIntent.getService(this, 0, snoozeIntent, 0);
添加到你的通知中去
// Constructs the Builder object.NotificationCompat.Builder builder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_stat_notification) .setContentTitle(getString(R.string.notification)) .setContentText(getString(R.string.ping)) .setDefaults(Notification.DEFAULT_ALL) // requires VIBRATE permission /* * Sets the big view "big text" style and supplies the * text (the user's reminder message) that will be displayed * in the detail area of the expanded notification. * These calls are ignored by the support library for * pre-4.1 devices. */ .setStyle(new NotificationCompat.BigTextStyle() .bigText(msg)) .addAction (R.drawable.ic_stat_dismiss, getString(R.string.dismiss), piDismiss) .addAction (R.drawable.ic_stat_snooze, getString(R.string.snooze), piSnooze);
0 0
- Android 使用大号的通知
- Android扩展通知栏(大号的Notification)
- android通知的使用
- Android 通知的使用
- Android系统设置大号字体后布局错乱的问题
- Android系统设置大号字体后布局错乱的问题
- 我的迅雷大号
- android中通知的使用
- android通知(Notification)的使用
- Android:通知栏的使用
- android Notification(通知) 的使用
- Android 通知栏的使用
- Android中通知的使用
- Android通知Notification的使用
- Android:通知栏的使用
- Android通知栏的使用
- ANDROID NOTIFICATION 通知的使用
- Android中通知的简单使用和自定义通知样式
- vs环境代码注释 所有方案
- swift学习第一天
- Arcgis api for JavaScript 跨域配置(在线编辑问题)
- 关于 Java 中 finally 语句块的深度辨析
- 回调函数的使用方法之例程说明
- Android 使用大号的通知
- QT自定义控件重叠颜色异常
- Sources for Android API 23 Platfrom not found (Android Studio 2.0)
- 关于多路归并排序 外部排序 败者树
- Java多线程与线程池
- 一个简单的DUMP
- lucent.net 分词
- 将引用的多个jar包通过MANIFEST.MF打包成一个jar
- 五种I/O模型