Search code examples
javalibgdx

Font size in textfield libgdx


How can I change the size of textfield font in libgdx?

UserNameTextField = new TextField("", GlobalSKin);
UserNameTextField. ???

Solution

  • There are various builtin methods you can call to set size. If you just want to set the size of textfield you can call

    UserNameTextField.setWidth(float width) Or UserNameTextField.setHeight(float width) or UserNameTextField.setMaxLength(maxLength)
    

    And if you only want to set size of font then do it like `

    TextField.TextFieldStyle textFieldStyle = skin.get(TextField.TextFieldStyle.class);
    textFieldStyle.font.scale(1.6f);
    

    `

    You can check all methods , just need to take a look at API.