In your activity, before setContentView()
requestWindowFeature(Window.FEATURE_NO_TITLE);
//Now you have a full screen view of an activity
if you are changing orientation of your phone from Portrait to Landscape, then add android:configChanges="orientation|screenSize"
in Activity tag Manifest.xml
, then in code do the following
private int oldOptions;
@Override
public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE)
{
oldOptions = getWindow().getDecorView().getSystemUiVisibility();
int newOptions = oldOptions;
newOptions &= ~View.SYSTEM_UI_FLAG_LOW_PROFILE;
newOptions |= View.SYSTEM_UI_FLAG_FULLSCREEN;
newOptions |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
newOptions |= View.SYSTEM_UI_FLAG_IMMERSIVE;
newOptions &= ~View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
getWindow().getDecorView().setSystemUiVisibility(newOptions);
getActionBar().hide();
}
else
{
getWindow().getDecorView().setSystemUiVisibility(oldOptions);
getActionBar().show();
}
}