Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 810
Jolly Avatar asked Jun 05 '14 20:06

Jolly


1 Answers

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.

like image 143
donfuxx Avatar answered Oct 14 '22 17:10

donfuxx