我正在使用v13支持库.我使用通知构建器和.setProgress构建进度通知.它在4.2.2设备上工作正常,但在2.3.5上没有显示任何内容.
这是正常的行为吗?
mNotifyManager = (notificationmanager) getSystemService(Context.NOTIFICATION_SERVICE);mBuilder = new NotificationCompat.Builder(this);mBuilder.setContentTitle("Photo Upload") .setContentText("Upload in progress") .setSmallicon(R.drawable.ic_action_upload) .setongoing(true);..mBuilder.setProgress(100, prog, false);mNotifyManager.notify(sNotificationID, mBuilder.build());
解决方法:
似乎不支持Gingerbread(及以下),也没有记录.
以下是支持库中创建Notification
实例的实际代码:
static class NotificationCompatImplBase implements NotificationCompatImpl { public Notification build(Builder b) { Notification result = (Notification) b.mNotification; result.setLatestEventInfo(b.mContext, b.mContentTitle, b.mContentText, b.mContentIntent); // translate high priority requests into legacy flag if (b.mPriority > PRIORITY_DEFAulT) { result.flags |= FLAG_HIGH_PRIORITY; } return result; }}
唯一可行的选择是使用自定义RemoteView
.您可能需要查看AndroID源代码以获取示例进度通知布局.
以上是内存溢出为你收集整理的android – NotificationBuilder.setProgress在2.3.5上没有做任何事情全部内容,希望文章能够帮你解决android – NotificationBuilder.setProgress在2.3.5上没有做任何事情所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)