1

I want that screen associated with an activity to be full sized. For this I using this code

    this.requestWindowFeature(Window.FEATURE_NO_TITLE); 
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().getDecorView().setSystemUiVisibility(View.GONE);
    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
    if (Build.VERSION.SDK_INT >= 14) {
        getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
    }

    if (Build.VERSION.SDK_INT >= 16) {
        getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
    }

However when doing a drag from touch screen appears bar with state (battery state, wifi state, etc). I using Android version 4.2.2 especially. This point I try to show in the picture below.enter image description here

How can that be maintained window to full screen programmatically?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Mihai8
  • 3,113
  • 1
  • 21
  • 31

2 Answers2

0

Most likely the problem occured because your code only executed once in onCreate. Try using this in your manifest instead :

<application 
    android:icon="@drawable/icon" 
    android:label="@string/app_name" 
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen">

For more information :

About the Full Screen And No Titlebar from manifest

Community
  • 1
  • 1
Blaze Tama
  • 10,828
  • 13
  • 69
  • 129
0

METHOD: 1 One way is using Theme.Holo.Light.NoActionBar.Fullscreen value in AndroidManifest.xml file. (Use the appropriate theme name whichever you used in your application)

<activity android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen">
</activity>

METHOD 2: Another way is, do this through code in the activity. In your activity do the following before calling setContentView() function

requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                            WindowManager.LayoutParams.FLAG_FULLSCREEN);        

setContentView(R.layout.activity_main);
Vibhor Chopra
  • 647
  • 4
  • 14