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

后端 未结 6 1248
故里飘歌
故里飘歌 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:24

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

    Yes, just call the vector drawable the standard way for notifications:

    .setSmallIcon(R.drawable.my_vector)
    

    In order to use the transparency (notification icons are only white and/or transparent), you will have to use the alpha channels when settings the colors in the vector XML, meaning #00000000 for transparent and #FFFFFFFF for white.

提交回复
热议问题