Can we add text to the drawing?

I want to create a drawable that looks like this.

enter image description here and enter image description here

I know how to create a wallpaper, but even after searching, I canโ€™t find how to transfer the text to this file. Is there a way for the popped file to be exactly the same as the text?

I can not use textview because its tab and I need drawings to set as the background of the resource (this is what I know, please correct me if I am wrong). Therefore, I want the paintable file to be set as the background.

enter image description here

+6
source share
2 answers

Yes you can do it.

See message -

How to place text in a drawing?

Basically, you should extend the Drawable class and set the canvas for drawing text to readable.

When you override the draw method, it will take the canvas and draw the text in certain places.

There are many methods for Canvas .

As explained in the graphic document. -

The Canvas class has its own set of drawing methods that you can use, like drawBitmap (...), drawRect (...), drawText (...) and many others. Other classes you can 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, which takes your Canvas as an argument.

The text of the drawing will look as follows:

 canvas.drawText("Front Screen Torch", 30, 48, paint); 

To get the actual color directly from the use of resources -

 paint.setColor(getResources().getColor(R.color.black)); 

See Canvas for more details.

0
source

Can I add text to a drawing?

No, you canโ€™t.

An alternative for this is to create a drawing with text.

0
source

All Articles