Can we use VectorDrawable or VectorXML as icons for push notifications in android?

后端 未结 6 1242
故里飘歌
故里飘歌 2021-01-03 21:06

I am using PNG image but its size is getting too big so I have to compromise with its quality. So i was thinking vectors may be the another way around ? Example will be a gr

6条回答
  •  半阙折子戏
    2021-01-03 21:48

    For version < 21,

    If you want to directly pass in vector drawable resource id into setSmallIcon(): No way.

    For setLargeIcon() indirectly, yes. Use

    VectorDrawableCompat drawable = VectorDrawableCompat.create(context.getResources(), resource id, theme);
    

    then create Bitmap from this drawable and pass into setLargeIcon()

提交回复
热议问题