android - How do libgdx detect keyboard presence -
when writing in textfield, need textfield move upwards in order let textfield visible when keyboard pops up.
does libgdx have kind of method returns true if keyboard visible , false when down?
the following code detect when press textfield, prevent showing keyboard , open native dialog moves , down keyboard. take input native dialog , put in textfield:
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) { textfield.settext(text); } @override public void canceled() { system.out.println("cancelled."); } }, "title", "default text..."); } });
good luck!
Comments
Post a Comment