2

I am trying to hide status bar but it is not working for me.

I tried to add

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

In AndroidManifest.xml But it is not working.

I also tried to add

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

In onCreate function

But nothing is working. I am using phonegap build. First time when i open my application status bar goes away but after 1 sec it comes back.

enter image description here

Can anyone help me?


I fix it. In onCreate function i add this lines

this.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);

Now status bar is hidden...

VoW
  • 315
  • 2
  • 13
  • Have you tried it with a normal android build? – JiTHiN Dec 06 '13 at 03:22
  • Also take a look at this SO question http://stackoverflow.com/questions/18237939/show-status-bar-in-android-in-phonegap-app-ie-prevent-fullscreen – JiTHiN Dec 06 '13 at 03:25
  • I tried with normal build and it works but in phonegap build it is not working... – VoW Dec 06 '13 at 03:39
  • You can't hide statusbar, unless you're running immersive mode in KitKat. – 323go Dec 06 '13 at 04:05
  • I fixed it with this.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); – VoW Dec 06 '13 at 04:51

3 Answers3

0

Oficial way: https://developer.android.com/training/system-ui/status.html

And you can try this:

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

Try that. You can check here: How to hide status bar in Android

Community
  • 1
  • 1
0

You can do it by two ways

1) Programatically :

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

public class ActivityName extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // remove title
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.main);
    }
}

2) Modifying AndroidManifest.xml file:

<activity android:name=".ActivityName"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
</activity>
Virag Brahme
  • 2,062
  • 1
  • 20
  • 32
  • Why you don't want to read my post at first time. I said that this ways is not working for me. I tried them. I fixed my problem by adding this.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); This Code. – VoW Dec 06 '13 at 18:35
-1

Just turn off the battery saver mode.

Sujil
  • 1