In my android app, I'd like to show a notification where the icon is a circled number, the number depending on other factors that caused the notification. I've seen other apps do it but I'm unsure how to do it myself. I can create the icon I'm looking for in an activity, but I can't seem to create text in a drawable, and I don't know how I'd go about modifying it from the java side to create a dynamic drawable.
Any help would be great :)
How I'm creating the shape in an activity:
activity
<TextView
android:id="@+id/icon"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginTop="0dp"
android:layout_marginLeft="20dp"
android:background="@drawable/circle"
android:gravity="center"
android:text="MY NUMBER HERE"
android:textColor="@android:color/tab_indicator_text"
android:textStyle="bold"
android:layout_centerVertical="true"
android:textSize="15sp"
/>
circle.xml
<?xml version="1.0" encoding="utf-8" ?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
<padding android:left="8dp" android:top="8dp"
android:right="8dp" android:bottom="8dp" />
<corners android:radius="200dp" />
<size android:height="25dp"
android:width="25dp"/>
<stroke
android:width="2dp"
android:color="@android:color/tab_indicator_text" />
</shape>
Edit: Found this: Android Notification Dynamic Icon
it seems to imply if I want to do this, I'll need to generate a drawable for each different number I want to do. Is there no other way?