-
-
Save belalmomani/5ad8e6ca2441c7c03af567ec540c5a3a to your computer and use it in GitHub Desktop.
F
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry for bothering you, but when I added this code the programme closed | |
public class MainActivity extends Activity { | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
} | |
@Override | |
public void onAttachedToWindow() { | |
this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG); | |
super.onAttachedToWindow(); | |
} | |
@Override | |
public void onWindowFocusChanged(boolean hasFocus) { | |
super.onWindowFocusChanged(hasFocus); | |
if (hasFocus) { | |
hideSystemUI(); | |
} | |
} | |
private void hideSystemUI() { | |
View decorView = getWindow().getDecorView(); | |
decorView.setSystemUiVisibility( | |
View.SYSTEM_UI_FLAG_IMMERSIVE | |
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE | |
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | |
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | |
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | |
| View.SYSTEM_UI_FLAG_FULLSCREEN); | |
} | |
private void showSystemUI() { | |
View decorView = getWindow().getDecorView(); | |
decorView.setSystemUiVisibility( | |
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | |
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | |
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment