Skip to content Skip to sidebar Skip to footer

Min Target Must Be Less Than 14 When Windowmanager.layoutparams.type_keyguard Used

I am trying to prevent status bar expansion and I have used some examples where people are trying to override the home button. All solutions point to using WindowManager.LayoutPar

Solution 1:

Update onAttachedToWindow as shown below and try

@OverridepublicvoidonAttachedToWindow() { 
    if (!GlobalVars.testing) {
       GlobalVars.preventStatusBarExpansion(this);
    }
    super.onAttachedToWindow();
}

and add update oncreate with

@Override
 protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,   WindowManager.LayoutParams.FLAG_FULLSCREEN);
    this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
    ...
 }

For Api above 14 use

this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);

Post a Comment for "Min Target Must Be Less Than 14 When Windowmanager.layoutparams.type_keyguard Used"