在文档(https://code.google.com/p/libgdx/wiki/scene2d)中指出:
如果在actor上调用setVisible(false),则不会调用其draw方法。它也不会接收输入事件。
我的代码是:
tableTopInfo.setVisible(false);
tableConsole.setVisible(false);
commandText.setVisible(false);
currentPosition.setVisible(false);
其中2个表对象添加了commandText和currentPosition。它不能正确绘制对象,但是textfield commandText仍会接收事件并将输入存储到textfield中。
谢谢。
我自己解决了这个问题:对于Textfield对象,需要再添加一行以真正禁用输入事件:
commandText.setDisabled(true);
不知道为什么文档没有明确说明。希望它对其他人有帮助。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句