我想在Android上使用libGDX实现一个包含可点击图像的表,但它不起作用。所以我尝试了以下代码进行测试:
Gdx.input.setInputProcessor(uiStage);
commandListTable = new Table(); //grid for UI command list;
commandListTable.setHeight(UIStageWidth * 1/2);
commandListTable.setWidth(UIStageWidth * 3.5f);
CreateButtons();
commandListTable.setPosition(UIStageWidth * 2 / 9, UIStageHeight * 1 / 15);
commandListTable.setTouchable(Touchable.enabled);
commandListTable.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
System.out.println("click " + x + ", " + y);
Gdx.app.log("Clicked", "CLICK");
}
});
uiStage.addActor(commandListTable);
然而,它仍然不起作用,完全没有输出。我做错了吗?