Android: Is it possible to update a ImageView/ImageButton with a number to show the number of new messages?

前端 未结 2 1033
感情败类
感情败类 2020-11-30 03:39

In iOS we have a feature to update the app icon with the new pending messages for the user by showing a small number on the right-top corner of the icon and similarly I woul

2条回答
  •  旧巷少年郎
    2020-11-30 03:55

    As you're looking to do this inside your app, not on the home screen, I'd suggest you just create an ImageView subclass, and override onDraw() - do any background painting, call super.onDraw(), then do foreground painting.

    Alternatively, you could use Bitmap.copy etc. to build a composite image from the base icon, and a smaller bitmap with the message count.

    Hope this helps,

    Phil Lello

提交回复
热议问题