android–NotificationBuilder.setProgress在2.3.5上没有做任何事情

android–NotificationBuilder.setProgress在2.3.5上没有做任何事情,第1张

概述我正在使用v13支持库.我使用通知构建器和.setProgress构建进度通知.它在4.2.2设备上工作正常,但在2.3.5上没有显示任何内容.这是正常的行为吗?mNotifyManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);mBuilder=newNotificationCompat.Buil

我正在使用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上没有做任何事情所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1116995.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存