0
我試圖隱藏導航欄,當鍵盤從活動中的編輯文本啓動時。我嘗試了很多解決方案,但沒有多少運氣。隱藏軟鍵盤啓動時的導航欄Android
下面的代碼我在這裏發現在這個論壇,但它並沒有消除鍵盤啓動時的導航欄。
private void setupMainWindowDisplayMode()
{
View decorView = setSystemUiVisilityMode();
decorView.setOnSystemUiVisibilityChangeListener(
new View.OnSystemUiVisibilityChangeListener()
{
@Override
public void onSystemUiVisibilityChange(int visibility)
{
setSystemUiVisilityMode(); // Needed to avoid exiting immersive_sticky when keyboard is displayed
}
});
}
private View setSystemUiVisilityMode()
{
View decorView = getWindow().getDecorView();
int options;
options = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
// hide nav bar
| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_IMMERSIVE |
View.SYSTEM_UI_LAYOUT_FLAGS;
decorView.setSystemUiVisibility(options);
return decorView;
}
任何建議,將衷心感謝