java - Libgdx - Textfield, show Keyboard input field -


im implementing login ui game on andoird. use libgdx textfield, android keyboard covers textfield, entered text cannot read.

as solution show small input area @ top of android keyboard this: keyboard input field example

i saw option replace default keyboard android textinput dialog, dont dialog wich pops up:

textfield.setonscreenkeyboard(new textfield.onscreenkeyboard() {         @override         public void show(boolean visible) {             //gdx.input.setonscreenkeyboardvisible(true);              gdx.input.gettextinput(new input.textinputlistener(){                 @override                 public void input(string text){                     tf_pw1.settext(text);                 }                  @override                 public void canceled(){                     system.out.println("cancelled.");                 }             }, "title", "default text...", "try out.");         }     }); 

is there build in option in libgdx use, or should implement myself?

please give advice or hints, thank you! :)

if want use builtin mechanism use gdx.input.gettextinput method

void gettextinput(input.textinputlistener listener,               java.lang.string title,               java.lang.string text,               java.lang.string hint) 

in following way:

    textinputlistener textlistener = new textinputlistener()     {         @override         public void input(string input)         {             system.out.println(input);         }          @override         public void canceled()          {             system.out.println("aborted");         }     };      gdx.input.gettextinput(textlistener, "your login: ", "placeholder", ""); 

second option make normal textinput , focus camera on zooming , changing camera position @ top of screen when user touch input - although there risk "missed" input , not zoom properly


Comments