Displaying text as an icon in the status bar
Asked Answered
E

0

8

I know that this questions has been asked, but there have been no answers. There are several apps that display both an Icon and a number with it (for example, if Android downloads more updates than will fit on the status bar, there is a download icon with a small number representing how many more icons would be displayed). Other apps display a % value or temperature. It was suggested that these apps simply have N icons (so, if temperature runs from 50C to 75C there would be 26 images (of various formats) that would be included with the code. What is worse is that if 70F - 105F were also required, the number of images would be very large.

What I would like to do is simply provide text that I could draw in a certain color (i.e 75F in green, but 99F in red), or change the background color, etc. Is there ANY WAY to do this without having to create 25+ images to represent each value? Note that I WANT the number in the status bar, not as a custom view when you click on the notification.

From the API, the icon is a resource that is passed to the Notification class as an integer. It would seem the only way to make this work is to dynamically create that icon and stuff it in the resources. Is this, or any other method, possible?

Note: I have looked at using the .number field of the Notification class. Although this gives me a number over the icon, it is not really what I am looking for, and, does not allow me to do a clean implementation (plus the number is really tiny).

Thanks in advance.

Marty

Enormous answered 9/12, 2011 at 5:36 Comment(2)
Follow this thread #6141768 This may help.Splenetic
possible duplicate of How to create a custom notification on Android. Text instead of imagePeerless

© 2022 - 2024 — McMap. All rights reserved.