使用textfiled用作輸入, ? 安卓上輸入完關(guān)閉輸入法后navigationbar不隱藏, 擋住游戲畫面
原理是當(dāng)獲取cocos2dx封裝的editor, 然后加入焦點(diǎn)變更的回調(diào)
AppActivity中
private Cocos2dxGLSurfaceView glSurfaceView;
private void hideSystemUI()
{
// Set the IMMERSIVE flag.
// Set the content to appear under the system bars so that the content
// doesn't resize when the system bars hide and show.
glSurfaceView.setSystemUiVisibility(
Cocos2dxGLSurfaceView.SYSTEM_UI_FLAG_LAYOUT_STABLE
| Cocos2dxGLSurfaceView.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| Cocos2dxGLSurfaceView.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| Cocos2dxGLSurfaceView.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
| Cocos2dxGLSurfaceView.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
| Cocos2dxGLSurfaceView.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
private class EditorOnFocusChangeListener implements OnFocusChangeListener{
@Override
public void onFocusChange(View v, boolean hasFocus)
{
if (hasFocus == false)
{
hideSystemUI();
}
}
}
然后在onCreate里面
glSurfaceView.getCocos2dxEditText().setOnFocusChangeListener(new EditorOnFocusChangeListener());