Android 设置图标nootification中的数字
我想在小图标通知中设置数字,而不是图片 我用过这个,但没用 int图标=12Android 设置图标nootification中的数字,android,Android,我想在小图标通知中设置数字,而不是图片 我用过这个,但没用 int图标=12 notification = new NotificationCompat.Builder(getApplicationContext()) .setPriority(NotificationCompat.PRIORITY_MIN) .setOngoing(true)
notification = new NotificationCompat.Builder(getApplicationContext())
.setPriority(NotificationCompat.PRIORITY_MIN)
.setOngoing(true)
.setSmallIcon(icon)
.setContentTitle(getString(R.string.SpeedNoti) +current)
.setContentText(
getString(R.string.distancenoti) + data.getDistance())
.setContentIntent(pendingIntent)
.setVisibility(NotificationCompat.VISIBILITY_SECRET)
.build();
传递给
setSmallIcon()
的int
必须是可绘图的资源ID。如果希望将数字12绘制为通知图标,则必须创建一个包含数字12的绘图表,将其添加到项目中,并将其资源ID传递给setSmallIcon()