Search code examples
javajsonlibgdxscene2d

Align text left in libgdx TextButton


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 :)


Solution

  • 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.