我正在尝试将我的通知状态栏图标设置为动画
android.R.drawable.stat_sys_upload,它工作正常,但图标不动画:
private void showStatusNotification() { notificationmanager notificationmanager = (notificationmanager) getSystemService(Context.NOTIFICATION_SERVICE); Builder notificationBuilder = new NotificationCompat.Builder(this); notificationBuilder.setAutoCancel(false); notificationBuilder.setongoing(true); notificationBuilder.setContentIntent(PendingIntent.getActivity(this,new Intent(this,MainActivity.class),PendingIntent.FLAG_UPDATE_CURRENT)); notificationBuilder.setContentTitle(getString(R.string.notification_title)); notificationBuilder.setContentText(getString(R.string.notification_text)); notificationBuilder.setSmallIcon(android.R.drawable.stat_sys_upload); notificationmanager .notify(STATUS_NOTIFICATION_ID,notificationBuilder.build()); }
解决方法
解决方案很简单,但非常棘手.你只需要添加
notificationBuilder.setTicker(getString(R.string.notification_ticker));
魔术发生了,你的图标也是动画的.它与这个bug有关:
http://code.google.com/p/android/issues/detail?id=15657
希望它可以帮到某人.
原文地址:https://www.jb51.cc/android/317184.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。