9

is there a way to align the text in a textbutton to left (or right) instead of center? I'v looked for it, but I cant seem to find it. Is it something that you can do with a .json skin file, and if so, how?

Thanks, if I was unprecise please let me know :)

Jolly
  • 399
  • 2
  • 12

2 Answers2

13

Yes you can align the text to the left side of the button, see example:

someButton.getLabel().setAlignment(Align.left);

so basically you have to align the button“s label to the left side inside the button. Obviously you can do the same for right, top, bottom alignment etc.

donfuxx
  • 11,277
  • 6
  • 44
  • 76
0

This also does the same thing, "adjusting the label position".

    Skin theSkin= new Skin();  
//Create a button style
    TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
    textButtonStyle.pressedOffsetY=-4.0f;
    textButtonStyle.unpressedOffsetY=-4.0f;
theSkin.add("default", textButtonStyle);
TextButton   theButton = new TextButton("New",theSkin);
VARUN ISAC
  • 443
  • 3
  • 13