android - 通知操作图标未显示

标签 android notifications icons action

我尝试在 Android 中显示通知,并使用来自 this Link 的代码. 在一些消息来源中,人们说图标应该是全白的,一些消息来源说我应该使用 .png 而不是 vector

我尝试了所有这些方法,但没有人不帮助我。

我试试这段代码:

Notification newMessageNotification =
    new Notification.Builder(mContext)
            .setSmallIcon(R.drawable.ic_message)
            .setContentTitle(getString(R.string.title))
            .setContentText(getString(R.string.content))
            .addAction(action))
            .build();

最佳答案

在与该主题有关的所有问题中搜索了大约 1 小时后,我终于发现这是因为我的 android 版本! 看下图。在Api level 24及以上,设计中没有图标!!

Android N notification screenshot

关于android - 通知操作图标未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44558501/

相关文章:

Android 应用程序退出事件

iPhone:从日期选择器获取日期

c# - 如何在 Windows 8.1 中获取 MessageBox 图标

android - WallpaperServices 绘制方法的类无效方法

android - 这是错误还是功能?在某些情况下,可以从不在 UI 线程上运行的任务访问 UI 线程

notifications - 查找来自 Service Worker 的事件推送通知的数量

java - 非 Activity 类的Android通知

android - 在应用程序 Activity 中创建图标并使它们透明

html - 如何使用我自己的图标获得社交书签?

android - 滚动到列表末尾