Android full screen codes not working

I am using these lines to get a full screen, but the panel for the battery and antenna is still there.

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

      

I even checked the line mentioned in How do I get rid of the top fade edge in Android full screen mode? When I add this ( setTheme(android.R.style.Theme_NoTitleBar_Fullscreen);

), the screen is enlarged, but it looks like the panel is on top of my screen. I naturally assume the OS (Android 4.0.4) does not allow this, but I was told that this code will force it to be like this, but it doesn't work, the final code will be more accurate:

public void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setTheme(android.R.style.Theme_NoTitleBar_Fullscreen);
        getWindow().setFlags(
                WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
        setListAdapter(new ArrayAdapter<String>(Menu.this,
                android.R.layout.simple_list_item_1, classes));
    }

      

Could you help me here?

+3


source to share


5 answers


To show an application in full screen mode:

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);

      



To remove it use:

getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

      

+1


source


you are doing everything right, the code is simple to get full screen

requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    //if you want it too other vice first one is good enough
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
            WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

      

**



Please note add it before setting setContentView

**



+2


source


EDIT: You seem to be fine except that you have the flag FLAG_FORCE_NOT_FULLSCREEN

twice

First, make sure your theme doesn't include an action bar. Then add the following to onCreate:

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

      

+1


source


for full screen mode you need to use the code below super.onCreate(savedInstanceState);

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

      

or If you are using Theme.AppCompat in your application you can use FullScreenTheme by adding below style in style.xml

<style name="Theme.AppCompat.Light.NoActionBar.FullScreen" 
 parent="@style/Theme.AppCompat.Light">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>

      

and also specify in the manifest file

    <activity
      android:name=".activities.FullViewActivity"
      android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen" 
     />

      

+1


source


This is what you are looking for:

https://developer.android.com/training/system-ui/immersive.html

Also, I am attaching a related question to you:

Using the new IMMERSIVE mode in android kitkat

0


source







All Articles