I was wondering that is it possible to create a custom drawable with stroke as border and this stroke contains text and for my ths question see the following image that I have created on Paint.

I have created a Linear Layout with stroke and a text 'Hello World' is on the stroke, so the question once again is that is it possible to create this type of stroke.
Your expected design can be achieved by the following code I just did and checked:
First use a custom background in
drawable: bg_gray_rectangle_rounded_corners.xmlthen in your main
xmlfile copy and paste thissnippet:Here is the output
Have a good day. Let me know if it helps.