notification遇到的坑
来源:互联网 发布:tensorflow 鸢尾花 编辑:程序博客网 时间:2024/04/29 22:42
给公司写一个类似优酷的超大Notification,先看了看文档, http://www.apiminer.org/doc/reference/android/app/Notification.BigPictureStyle.html 原来实现起来简单!为了扩展性,我这里选择的自定义,查了下文档,普通通知栏高度64dp,BigPictureStyle或者BigTextStyle的样式通知栏是256dp,这里需要注意一下,这两个样式是在4.1(API16)之后才有的!
定义两个布局,一个normal_notify,一个big_notify
Notification n = b.build(); RemoteViews bigView = new RemoteViews(context.getPackageName(), R.layout.remoteview_bigimage_push); bigView.setImageViewBitmap(R.id.imageview, bigBitmap); n.bigContentView = bigView; RemoteViews normalView = new RemoteViews(context.getPackageName(), R.layout.remoteview_nmimage_push); normalView.setImageViewBitmap(R.id.imageview, normalBitmap); n.contentView = normalView;
跑起来!完美!
然后把demo向项目里面挪,一个notify控制类,两个布局,没了,很简单!
运行项目,结果 Bad Notification from package ....,这个问题很常见,难道我布局有Notifiction不支持的控件,不对啊,我布局里目前只有ImageView,然后想到的是没设置ContentIntent,review了一遍,发现设置了,哎,奇怪了!
一路找。。。
最后发现两个layout文件放到 layout-land/目录下,坑爹的Androidstudio!
最后放到layout下,问题解决!
放下效果图吧:
1 0
- notification遇到的坑
- 通知Notification遇到的坑
- 魅族 Notification 遇到的奇葩问题
- 使用Orientation Changed Notification遇到的问题及解决办法
- 在notification中使用remoteview遇到的问题
- android notification和peddingintent结合使用遇到的问题
- 安卓自定义Notification包含进度条时遇到的问题
- notification 推送警告- 通知集成遇到的问题
- 使用 Android 自定义通知Notification时遇到的问题
- Notification踩过的坑
- android Notification分析——你可能遇到的各种问题
- android Notification分析——你可能遇到的各种问题
- android Notification分析——你可能遇到的各种问题
- IOS上架提交审核遇到Missing Push Notification Entitlement的问题
- 默认的Notification和自定义的Notification
- Push Notification、Local Notification、broadcast Notification的区别
- 第一次写博客,来记录一些工作中遇到的技术问题---关于android的Notification学习的记录
- android Notification的实例与Notification API
- 黑马程序员 -IO流(上)
- make menuconfig 配置
- fastjson-1.1.34.android,和xUtils-2.6.13简单用法1,将网络新闻转化到app
- 虚拟机字节码执行引擎
- Android 循环广告位轮播图的封装实现
- notification遇到的坑
- LaTex 空格问题~~~~~
- 格式化JSON的NODE.JS代码片段
- uva10066
- 麻省理工学院公开课:计算机科学及编程导论问题1
- GMS(Google Mobile Service)预制方法
- Android数据存储实现的5大方式
- 10 条提升 Android 性能的建议(转)
- Hello CSDN