Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I focus a Textfield?

Tags:

java

libgdx

I want to focus a libGDX Textfield from the code without clicking on the Textfield.
Is there a way to do this?

like image 867
Liquidz Avatar asked Jul 08 '13 08:07

Liquidz


1 Answers

I was having the same question, finally found the answer by looking at TextField code.

You can focus your text field by doing this:

stage.setKeyboardFocus(textField);
//show the keyboard
textField.getOnscreenKeyboard().show(true);

Hope this help someone.

like image 156
code_blue Avatar answered Nov 12 '22 04:11

code_blue