我正在創建一個libGDX框架的Android遊戲。 我的設置屏幕是通過scene2d實現的。 我通過實現一個inputProcessorAdapter類來處理後退按鈕單擊事件。將它和Stage添加到InputMultiplexer進行輸入處理。libgdx輸入處理後,通過點擊adView打開的網頁支持不工作
一切正常除了點擊屏幕底部的廣告後,然後從谷歌廣告網頁返回到屏幕。返回鍵不再可以被inputProcessorAdapter捕獲。當舞臺的Textfield集中時,鍵盤也不再顯示。 以下是我的輸入處理代碼。
inputProcessor = new InputProcessorAdapter() {
@Override
public boolean keyDown(int keycode) {
if (keycode == Input.Keys.BACK) {
// Go back to main menu
stage.unfocusAll();
Gdx.input.setOnscreenKeyboardVisible(false);
SettingScreen.this.game.setScreen(new MainMenuScreen(SettingScreen.this.game));
}
return false;
}
};
InputMultiplexer multiplexer = new InputMultiplexer();
multiplexer.addProcessor(inputProcessor);
multiplexer.addProcessor(stage);
Gdx.input.setInputProcessor(multiplexer);
等待您的答案或建議。
非常感謝您的早期回答。我試過你的解決方案,但它仍然無法正常工作。實際上,我從頭開始在libgdx遊戲類的create()方法中添加了'Gdx.input.setCatchBackKey(true);'。 – go3boy