3

If I have an Activity with a fullscreen theme, set up like this:

<activity
    android:name=".FullscreenActivity"
    android:theme="@style/MyTheme.FullScreen"/>

With MyTheme.FullScreen defined as:

<style name="MyTheme.FullScreen" 
       parent="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen">
</style>

... is it possible to exit fullscreen mode programmatically? I specifically want to show the Action Bar (with its navigation options) in certain situations, while usually having the activity in fullscreen mode.

I have tried approaches like the following as suggested here. From some comments, others are having problems with this on Android 4.0+ too.

getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
currentContentView.requestLayout();

Also tried content.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);, to no avail.

I also looked at "Smooth full screen transition", but it seems a bit hacky for my needs, and I'd much prefer a simpler solution.

Targeting Android 4.0 and above:

android:minSdkVersion="14"
android:targetSdkVersion="19"
Community
  • 1
  • 1
Jonik
  • 80,077
  • 70
  • 264
  • 372
  • try this ActivitiesCurrentContentView.requestLayout(); not this currentContentView.requestLayout(); – ibad ur rahman Jan 26 '14 at 12:28
  • getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); use this sequance also – ibad ur rahman Jan 26 '14 at 12:30
  • 1
    What do you mean by ActivitiesCurrentContentView? There is no such class in Android. What I have already tried is exactly storing current activity's content view in a field and calling requestLayout on that. – Jonik Jan 26 '14 at 12:35

0 Answers0