Reputation: 433
I know this has been asked before, in fact Ive been googling it for days, but I cant get my app to go full screen in android api 19 os version 4.2.1
Ive tried
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
and also
getWindow().getDecorView()
.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
but neither of these work. I also tried choosing a full screen theme in the manifest file but this didnt work. What could be wrong?
Upvotes: 1
Views: 1016
Reputation: 1147
Make sure you're calling your code before you call your setContentView();
Otherwise, it won't have any affect. Something like this:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
}
Upvotes: 1