e.g. try this shape and do not call resizeToFit. If you need to display larger texts on a single row, you might have to set even larger left/right coordinates;
float l = -300; // text bounds left, in %
float r = 400;
float t = -500;
float b = 0;
new Shape(
// circle part
Shape.fromId("Ellipse").getOutline(),
// no decorations
null,
// text region
new ElementTemplate[]
{
new LineTemplate(l, t, r, t),
new LineTemplate(r, t, r, b),
new LineTemplate(r, b, l, b),
new LineTemplate(l, b, l, t),
},
Path.FillType.WINDING, "CircleWithTextAbove");
Call shapeNode.setTextFormat(new TextFormat(Align.Center, Align.Far)) to bottom-align the text in text region which is above the ellipse, and the text should stay at default 1 millimeter margin distance from its top. You can change that distance by calling setTextPadding method.