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

4

2 回答 2

13

是的,您可以将文本与按钮的左侧对齐,请参见示例:

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

所以基本上你必须将按钮的标签与按钮内的左侧对齐。显然,您可以对右对齐、顶部对齐、底部对齐等执行相同的操作。

于 2014-06-17T19:10:43.117 回答
0

这也做同样的事情,“调整标签位置”。

    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);
于 2016-08-22T11:41:21.733 回答