我正在尝试禁用我编码的TextButton,如下所示:
// Setup new game button
final TextButton newGameButton = new TextButton("New Game", style);
newGameButton.addListener(new InputListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y,
int pointer, int button) {
Tyr.getInstance().setScreen(new GameScreen());
AudioHelper.stopMusic();
return true;
}
});
table.add(newGameButton).spaceBottom(BUTTON_SPACE);
table.row();
然而," setDisabled(true)"功能似乎不起作用。还有其他方法可以完成这项任务吗?
答案 0 :(得分:20)
找到解决方案:“newGameButton.setTouchable(Touchable.disabled);”