Hide Status bar on Android Ice Cream Sandwich
Asked Answered
A

6

13

I'm working in a launcher for Android ICS but I have a problem with tablets.

I can't hide the status bar. I have try it in Android 2.3.X and it's ok. The problem appears only with Android 4.0.

How can I hide it?

Aesop answered 15/3, 2012 at 22:59 Comment(0)
A
5

You cannot get rid of the system bar on tablets. You may be able to get rid of the navigation bar and status bar on phones. Please read the "Controls for system UI visibility" section of the Android 4.0 SDK release notes.

Anasarca answered 15/3, 2012 at 23:4 Comment(11)
Ok... i can´t hide it... but can I block /override the actions of the buttons?Aesop
Why video player is full screen and hides status bar?Aesop
The video player does not hide the system bar on ICS tablets.Anasarca
is possible to disable some of the buttons of the status bar? (notifications/settings and running apps)Aesop
@NachoMV: No. You can dim them, though.Anasarca
How can we dim the (notifications/settings and running apps) button on status bar of tablet?Garibold
@Shrikant: Use STATUS_BAR_HIDDEN or SYSTEM_UI_FLAG_LOW_PROFILE with setSystemUiVisibility() on any View.Anasarca
I used STATUS_BAR_HIDDEN but I am able to click on the running apps button. Basically, I have implemented (custom)lock screen facility in my app where UI will be visible to user but he cannot click on any view from the UI, so for that I have disabled home and back key as well but if user presses the recent activity button, the app can get minimized which I don't want to happen. KEYCODE_APP_SWITCH is also not working. So can you tell me is it possible to ignore this event?Garibold
@Anasarca indeed it is not possible within the given framework, but there are workarounds for rooted devices. This can be very useful for developers looking to create kiosk applications.Franky
@ılǝ : I am creating a create kiosk mode appln,and need to hide the status bar on my 4.2.2 tablet.Do you know how can I achieve it ?Carruth
@Carruth You can use the HideBar project but you need super user access to the system, i.e. you need to have rooted the device. See my answer below.Franky
B
11

You can not get 100% true full screen in Android 4.0.

Use the following to dim the notification bar (aka. status bar, system bar)

 getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);

And use this to hide it

 getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

And, if I guess right, you are trying to achieve a "kiosk mode". You can get a little help with an app named "surelock". This blocks all the "home" and "back" actions.

It is still not perfect but this may be the best we can achieve with Android ICS.

Berate answered 1/4, 2012 at 14:51 Comment(2)
I would really like to know how Surelock is able to hide Home and back button to do it within my app. Can you help?Prudence
@Prudence SureLock replaces your default launcher, so when you press the back or home buttons you are taken back to SureLock. They also have an option that looks for un-whitelisted processes and kills them.Vocational
L
7

It is possible to hide the statusbar on a rooted android device. The program Hidebar does this by killing the systemui process. The program is open source, so you can read all about it in the source code.

See http://ppareit.github.com/HideBar/.

Larhondalari answered 9/6, 2012 at 10:25 Comment(3)
Do NOT attempt this on Android 4.0 ICS as SystemUI is responsible for just about everything and will result in erratic behavior. It resets the system wallpaper, removes the bottom software buttons, etc.Hendrickson
the suggestion by @Larhondalari works +1, but one should make themselves familiar with risks involvedFranky
Thanks @ile. Newer versions of HideBar have a new and more advanced method to hide the systembar. HideBar also supports an interface using 'Intents', so that other applications can ask to hide the systembar. There are added permissions, so that the user knows what applications are allowed to hide the systembar. If you need this this in your own application, you are best to contact me using the address provided on the site of HideBar.Larhondalari
A
5

You cannot get rid of the system bar on tablets. You may be able to get rid of the navigation bar and status bar on phones. Please read the "Controls for system UI visibility" section of the Android 4.0 SDK release notes.

Anasarca answered 15/3, 2012 at 23:4 Comment(11)
Ok... i can´t hide it... but can I block /override the actions of the buttons?Aesop
Why video player is full screen and hides status bar?Aesop
The video player does not hide the system bar on ICS tablets.Anasarca
is possible to disable some of the buttons of the status bar? (notifications/settings and running apps)Aesop
@NachoMV: No. You can dim them, though.Anasarca
How can we dim the (notifications/settings and running apps) button on status bar of tablet?Garibold
@Shrikant: Use STATUS_BAR_HIDDEN or SYSTEM_UI_FLAG_LOW_PROFILE with setSystemUiVisibility() on any View.Anasarca
I used STATUS_BAR_HIDDEN but I am able to click on the running apps button. Basically, I have implemented (custom)lock screen facility in my app where UI will be visible to user but he cannot click on any view from the UI, so for that I have disabled home and back key as well but if user presses the recent activity button, the app can get minimized which I don't want to happen. KEYCODE_APP_SWITCH is also not working. So can you tell me is it possible to ignore this event?Garibold
@Anasarca indeed it is not possible within the given framework, but there are workarounds for rooted devices. This can be very useful for developers looking to create kiosk applications.Franky
@ılǝ : I am creating a create kiosk mode appln,and need to hide the status bar on my 4.2.2 tablet.Do you know how can I achieve it ?Carruth
@Carruth You can use the HideBar project but you need super user access to the system, i.e. you need to have rooted the device. See my answer below.Franky
P
4

I know my answer comes a bit late, but after assembling info from various places, I came up with this, which works ONLY ON ROOTED DEVICES:

    private void    KillStatusBar()
{
    Process proc = null;

    String ProcID = "79"; //HONEYCOMB AND OLDER

    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH){
        ProcID = "42"; //ICS AND NEWER
    }

    try {
        proc = Runtime
                .getRuntime()
                .exec(new String[] { "su", "-c",
                        "service call activity "+ProcID+" s16 com.android.systemui" });
    } catch (IOException e) {
        Log.w(TAG,"Failed to kill task bar (1).");
        e.printStackTrace();
    }
    try {
        proc.waitFor();
    } catch (InterruptedException e) {
        Log.w(TAG,"Failed to kill task bar (2).");
        e.printStackTrace();
    }

}

This should eliminate the bottom bar on any rooted device and turn it into "kiosk" mode.

Pride answered 18/2, 2013 at 16:18 Comment(0)
L
2

To hide status bar and navigation bar in android 4.0, we should use code below:

LinearLayout layout = (LinearLayout)findViewById(R.id.layout);
layout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
Loudmouth answered 22/9, 2012 at 4:50 Comment(0)
I
1

Building upon ppareit's answer.

You can not hide the navigation bar on most stock devices. However, there is a work around if you rooting the device is an option. Here are the steps for one solution:

  1. Root device

  2. Install and run Busybox (required for taking full advantage of rooted device)

  3. Install HideBar from resource

In HideBar there is an option to run in 'Kiosk' mode, in which there is no way to re-display the navigation bar. Needless to say, you really need to be careful with this.

Improvvisatore answered 17/11, 2012 at 15:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.