java - LibGDX internal button spacing -
i trying create gui in libgdx, having problems buttons. using 9patch image button, looks this:
this button scales well, it's when add text button there space between top of button, , top of text. this:
the red line marks amount of space between top of button , top of text. space large, , wondering if there way reduce it.
the font using not scaled, , normal bitmapfont no filter. regardless of scale, space between text , top edge proportionate, meaning space still looks same size when using small font or large font, relative text size.
any suggestions appreciated.
to solve problem did following.
when adding button table, used following code.
table.add(button).height(height).width(width);
this did not solve mentioned issue, allowed me explicitly set desired width , height of button, played part in solving actual issue. when creating button, button, being extension of cell, used add() function re-position text.
button = new textbutton("button", style); button.add(button.getlabel()).padbottom(constant);
combined cell.height()
function, able use constant padding variable position button's text (or label) in middle of button.
Comments
Post a Comment