Hide Status bar on Android Ice Cream Sandwich

后端 未结 6 979
醉梦人生
醉梦人生 2020-12-23 18:14

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

相关标签:
6条回答
  • 2020-12-23 18:32

    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.

    0 讨论(0)
  • 2020-12-23 18:44

    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.

    0 讨论(0)
  • 2020-12-23 18:49

    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);
    
    0 讨论(0)
  • 2020-12-23 18:52

    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/.

    0 讨论(0)
  • 2020-12-23 18:54

    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.

    0 讨论(0)
  • 2020-12-23 18:59

    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.

    0 讨论(0)
提交回复
热议问题