How to create a custom notification on Android. Text instead of image

I want to create a notification, like here:

enter image description here

Red circle = icon that is always displayed. Blue circle = icon that appears only when it is expanded.

How to make such a red circle notice?

Should I create 100 images or can I use a custom notification like text? Can I join two images together?

I found this:

http://www.framentos.com/en/android-tutorial/2012/02/20/how-to-create-a-custom-notification-on-android/

Custom notification layouts and text colors

But I still don’t know how to create this red circle. With this, I know how to create a blue circle, but I don’t need it. I do not create a battery!

Any ideas?

+2
source share
1 answer

The only text that you can put in the notification area / status bar (the "red circle") is the text of the ticker, which disappears after it is displayed (setTicker). The purpose of this area is to remind users that the notification is outstanding using the small icon (setSmallIcon). You can make 100 different icons, one for each percent, but then you won’t use the standard Android design rules for notifications.

I suggest that if you need a battery indicator, use 5 battery icons. One icon will be a "full" battery, along with 1 at 75%, 50%, 25% and "very low" (red). I suspect that most users do not need to see exactly how many remaining batteries are left in the status bar. Then you can show the exact numbers and the estimated time remaining in the full notification.

+4
source

Source: https://habr.com/ru/post/903433/


All Articles