Qbix Qbix - 1 year ago 223
Java Question

How to set a text padding in a TextField?

enter image description here

I need to set a left-padding of the text inside a TextField.
There is a method

setAlign(Align.TOP | BOTTOM | CENTER)
but I need to hardcode a value so it looks nice.

Here's my current code:

TextField loginField = new TextField("", skin);
TextField passwordField = new TextField("", skin);


I've tried editing the TextFieldStyle, but still with no success.
Thanks for any ideas!

Answer Source

You can use passwordField.getStyle().background.setLeftWidth method to add left padding.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download