Reputation: 13
I need to disable the notification bar inside my app on android 4.4, this code is working for fist time disable the notification bar, second time when i dropdown i can view the notification. can i set notification bar disable in my activity for a while. please help me by any way.
Her is my code ....
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
View decorView = getWindow().getDecorView();
int uiOptions = View. SYSTEM_UI_FLAG_FULLSCREEN;
int uiOption = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
decorView.setSystemUiVisibility(uiOptions);
decorView.setSystemUiVisibility(uiOption);
decorView.requestFocus();
decorView.requestFocusFromTouch();
}
Upvotes: 0
Views: 213
Reputation: 418
try this code :
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
this should be added before the setContentView();
and for hiding actionbar :
getActionBar().hide;
and if that dont work try this..
requestWindowFeature(Window.FEATURE_NO_TITLE);
Upvotes: 1
Reputation: 2888
What about using immersive full-screen mode, that was introduces in 4.4? Seems to me, it is what you need. More details: https://developer.android.com/training/system-ui/immersive.html
Upvotes: 0