Yes you can do that.
See the post -
How to put text in a drawable ?
Basically, you have to extend the class Drawable
and set the canvas to draw the text
to a drawable.
As you override the draw
method, it will take the canvas and draw the text on defined locations.
There are many methods available for Canvas
.
As explained in a graphics doc. -
The Canvas class has its own set of drawing methods that you can use, like drawBitmap(...), drawRect(...), drawText(...), and many more. Other classes that you might use also have draw() methods. For example, you'll probably have some Drawable objects that you want to put on the Canvas. Drawable has its own draw() method that takes your Canvas as an argument.
Drawing text will be just like the following -
canvas.drawText("Front Screen Torch", 30, 48, paint);
To get the actual color directly from resources use -
paint.setColor(getResources().getColor(R.color.black));
See Canvas for more.