Android 4.4 — Translucent status/navigation bars — fitsSystemWindows/clipToPadding don't work through fragment transactions

前端 未结 8 2099
余生分开走
余生分开走 2021-01-30 11:30

When using the translucent status and navigation bars from the new Android 4.4 KitKat APIs, setting fitsSystemWindows=\"true\" and clipToPadding=\"false\"

8条回答
  •  遥遥无期
    2021-01-30 12:06

    I encountered the same problem. When I replace Fragment. The 'fitsSystemWindows' doesn't work.

    I fixed by code add to your fragment

    @Override
    public void onViewCreated(final View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        AndroidUtil.runOnUIThread(new Runnable() {
            @Override
            public void run() {
                ((ViewGroup) getView().getParent()).setFitsSystemWindows(true);
            }
        });
    }
    

提交回复
热议问题