table.setPosition(0, 0);
table.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
table.setTouchable(Touchable.enabled);
table.addListener(new ClickListener(){
@Override
public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
System.out.println("me working");
nextPhrase();
}
});
stage.addActor(table);
touchUp方法不觸發。表格包含圖像和標籤並填充屏幕。我需要nextPhrase()方法觸發屏幕時觸發。我該怎麼辦?爲什麼touchUp方法不觸發?
我不知道libgdx,但我讀到那裏(http://stackoverflow.com/questions/35287866/libgdx-how-to-handle-touch-event),你需要一個InputListener而不是ClickListener(它會聽取點擊,我相信) –