We saw in many games or another application that splash
activity starts on full screen without status bar or anything. It’s very easy
to implement this.
There are two sets of codes for android version 4.1 above
and below. So I have put in If statement both codes.
Step-1: Copy and paste the below codes after
setContentView() in onCreate(), whichever activity you want in full screen.
Code:
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
else{
View decorView =
getWindow().getDecorView();
// Hide the status
bar.
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
// Remember that
you should never show the action bar if the
// status bar is
hidden, so hide that too if necessary.
ActionBar actionBar =
getActionBar();
actionBar.hide();
}
Step-2: After pasting this code will give some
errors.Keep the mouse cursor on red and
import relataed classes. . Your code will run.