android Q content above navigation bar

后端 未结 3 1721
耶瑟儿~
耶瑟儿~ 2021-01-18 08:51

we are targeting our application at api 28 and draw content under status bar. For this we are using following flag and styles :

window.addFlags(FLAG_LAYOUT_N         


        
3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-18 09:30

    In android api 29, Bottom bar is overlapping the content.

    Add this code in your activity

        getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
    
    
        ViewCompat.setOnApplyWindowInsetsListener(getWindow().getDecorView(), new OnApplyWindowInsetsListener() {
            @Override
            public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) {
                v.setPadding(0, 0, 0, v.getPaddingBottom() + insets.getSystemWindowInsetBottom());
                return insets;
            }
        });
    

提交回复
热议问题