通知的综合应用
来源:互联网 发布:梅西c罗数据对比最新 编辑:程序博客网 时间:2024/05/08 14:25
1.取消通知
创建的时候调用setAuthCancek(true),用户点击自动消失,多好
- The user dismisses the notification either individually or by using "Clear All" (if the notification can be cleared).
- The user clicks the notification, and you called
setAutoCancel()
when you created the notification. - You call
cancel()
for a specific notification ID. This method also deletes ongoing notifications. - You call
cancelAll()
, which removes all of the notifications you previously issued.
Preserving Navigation when Starting an Activity
启动一个新的活动,要能导航,这个,还不太明白,需要进一步学习?
最后自定义布局:
定义个布局文件:ImageView的background没法用颜色啊,为什么
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#545454"
android:gravity="center_horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/codeversed_logo"
android:contentDescription="@string/codeversed_logo"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
// Creates an explicit intent for an ResultActivity to receive.
Intent resultIntent = new Intent(this, ResultActivity.class);
// This ensures that the back button follows the recommended
// convention for the back key.
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
// Adds the back stack for the Intent (but not the Intent itself)
stackBuilder.addParentStack(ResultActivity.class);
// Adds the Intent that starts the Activity to the top of the stack.
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(
0, PendingIntent.FLAG_UPDATE_CURRENT);
// Create remote view and set bigContentView.
RemoteViews expandedView = new RemoteViews(this.getPackageName(),
R.layout.notification_custom_remote);
expandedView.setTextViewText(R.id.text_view, "Neat logo!");
Notification notification = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setAutoCancel(true)
.setContentIntent(resultPendingIntent)
.setContentTitle("Custom View").build();
notification.bigContentView = expandedView;
- 通知的综合应用
- MSHFlexGrid的综合应用
- listview的综合应用
- 循环的综合应用
- CSS的综合应用
- Web的综合应用
- AngularJs的综合应用
- NSWorkspace的综合应用
- ios的通知应用
- 通知的应用
- Oracle 监听器 的综合应用
- STL Set的综合应用
- SSH框架的综合应用
- 一维小波降噪的综合应用实例
- 表单处理的综合应用
- 多线程技术的综合应用
- File类的综合应用
- android 应用的通知栏
- 【翻译】 Unity3D VR 教程:3.VR中的交互
- android switch button 报 java.lang.NullPointerException: Attempt to invoke virtual method 'boolean
- Detecting Insults in Social Commentary 数据分析报告(python)
- 移动开发利器-Bmob后端云使用体验
- nyoj 541 最强DE 战斗力(数论)
- 通知的综合应用
- Bitmap.createBitmap学习笔记
- 查找旋转数组的最小值
- 机器学习(Machine Learning)&深度学习(Deep Learning)资料
- shell脚本中echo显示内容带颜色
- MathType中批量修改公式的格式
- 高精度总结(高精度类和重载运算高精度阶乘)
- [Asp.Net MVC4]验证用户登录实现
- javascript:void(0)与return false的区别