Disable full screen mode on android

How can I enable a black opaque tool bar on android to avoid drowing game scene under the tool bar?
Everything I have already done are:


in Cocos2dxActivity::init(), but now I have transparent constant tool bar with game scene under it. But I want my game scene’s top does start from tool bar’s bottom.

Thank You in advance.

Did you mean you want the tool bar? What version did you use?

@zhangxm, Yes, excatly. I use Creator 2.4.3 with vanilla engines.

I think you can comment the codes

WindowManager.LayoutParams lp = getWindow().getAttributes();
        try {
            Field field = lp.getClass().getField("layoutInDisplayCutoutMode");
            //Field constValue = lp.getClass().getDeclaredField("LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER");
            Field constValue = lp.getClass().getDeclaredField("LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES");
            field.setInt(lp, constValue.getInt(null));
            // https://developer.android.com/training/system-ui/immersive
            int flag = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;

            flag |= View.class.getDeclaredField("SYSTEM_UI_FLAG_IMMERSIVE_STICKY").getInt(null);
            View view = getWindow().getDecorView();

        } catch (NoSuchFieldException e) {
        } catch (IllegalAccessException e) {

in Cocos2dxActivity.java.