文本字段 libgdx 中的字体大小

2022-01-12 00:00:00 java libgdx

如何在 libgdx 中更改文本字段字体的大小?

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

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

推荐答案

您可以调用各种内置方法来设置大小.如果您只想设置文本字段的大小,您可以调用

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

`

你可以检查所有方法,只需要看看API.

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

相关文章