2019独角兽企业重金招聘Python工程师标准>>>
官方Wiki:https://github.com/libgdx/libgdx/wiki/Simple-text-input
实现接口TextInputListener
public class MyTextInputListener implements TextInputListener { @Overridepublic void input (String text) {} @Overridepublic void canceled () {}
}
在用户输入的时候,会触发input()方法。
在用户关闭对话框或者按返回键时,会触发canceled()方法。
MyTextInputListener listener = new MyTextInputListener();
Gdx.input.getTextInput(listener, "Dialog Title", "Initial Textfield Value","hint");
listener方法将在绘制线程内调用。在ApplicationListener.render()
之前调用。