Android - status bar prevents full screen

前端 未结 4 1318
陌清茗
陌清茗 2021-02-08 23:47

My app correctly runs in full screen when it\'s started. However after minimizing and then returning to the app, the status bar pops up and pushes my views down a little. How ca

相关标签:
4条回答
  • 2021-02-09 00:02

    There are known bugs with the status bar / notification bar.

    See:

    http://code.google.com/p/android/issues/detail?id=3674

    http://code.google.com/p/android/issues/detail?id=8052

    http://code.google.com/p/android/issues/detail?id=5906

    0 讨论(0)
  • 2021-02-09 00:11

    I had the same issue. I changed the activity for the interstitial and deleted: android:theme="@android:style/Theme.Translucent"

    0 讨论(0)
  • 2021-02-09 00:22

    Just android:theme="@android:style/Theme.NoTitleBar.Fullscreen" attribute on your activity on the manifest is enough. Hope its works

    0 讨论(0)
  • 2021-02-09 00:23

    You can fix this issue with:

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

    (do that in onCreate).... note that this will break the soft keyboard (IME) - as edittext can no longer slide into view above the keyboard. That flag prevents the window from moving at all....

    If you need an edit text to also work while fixing the status bug you can do

    someEditText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            public void onFocusChange(View v, boolean hasFocus) {
                if (hasFocus) {
                    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
                } else {
                    hideKeyboard();
                    getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
                }   
            }
        });
    
    0 讨论(0)
提交回复
热议问题