IllegalArgumentException: Window type can not be changed after the window is added

前端 未结 5 701
走了就别回头了
走了就别回头了 2021-01-03 21:21

I\'ve tried the advice here, the advice here, the advice here, I\'ve commented out the onAttachedToWindow() in my Base Activity. I have two Activities inheriting from this

5条回答
  •  天涯浪人
    2021-01-03 21:28

    I run into the same question. But after stopping adding

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    

    before super.onCreate(savedInstanceState); of BaseActivity, it works well. I cut and paste above codes before super.onCreate(savedInstanceState); of descends of BaseActivity.

    BTW, I don't think you have to call super.onAttachedToWindow(); inside methods of life circle of Activity. Because onAttachedToWindow(); is called when the view is attached to a window when you overriding a View.

提交回复
热议问题