 I have an Activity and a Fragment in my project.In the Activity I set the layout take the entire screen and in fragment I try to change the status bar color programmatically. The status bar is shown over the layout but the color is not changed.
I have an Activity and a Fragment in my project.In the Activity I set the layout take the entire screen and in fragment I try to change the status bar color programmatically. The status bar is shown over the layout but the color is not changed.
Activity:
if (Build.VERSION.SDK_INT > 16) {
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
        }
Fragment:
 if (Build.VERSION.SDK_INT > 16) {
            getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
                    WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
            if (Build.VERSION.SDK_INT >= 21) {
                Log.e("statusbarcolor","changing..");
                getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(),R.color.statusBarColor));
            }
        }
 
     
     
     
    