Notification throws error when using vector drawables

馋奶兔 提交于 2019-12-02 17:33:43

You are using the vector drawable support package. That's fine, but that only works in your app. The platform does not know how to use vector drawables prior to API Level 21, and for a Notification, the platform is the one rendering the resource.

You could render the vector drawable yourself to a Canvas backed by a Bitmap, then use that Bitmap in the Notification. Or, you could use the vector backport library in general, but for your handful of Notification icons, generate PNG files for them and use them on the older devices. Put the corresponding vector drawables in res/drawable-anydpi-v21/, and the newer devices will use the vector drawables while older devices fall back to the PNGs.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!