当我按下 Edittext 时出现 ActionBar,当我完成输入并关闭键盘时它仍然存在

ActionBar appears when i press on Edittext and when i finish typing and close the keyboard it is still there

有没有办法永久删除这个操作栏?我尝试了这两种方法,但它们没有用:

这个..

    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>

还有这个...

    getWindow().getDecorView().setSystemUiVisibility(
              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
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);

首先activity:

当我点击 EditText 时:

那不是 ActionBar 它在 android 中被称为 Status bar。因为它会保留一些重要实用程序的状态,例如您的网络和电池状态。

回答你的问题。

FOR Android 4.0 and Lower

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);

FOR Android 4.1 and Higher

View decorView = getWindow().getDecorView();

int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
//if you have action bar present make sure to hide it
ActionBar actionBar = getActionBar();
actionBar.hide();