【问题标题】:How to hide and show System Bar in Android (4.1.1)如何在Android(4.1.1)中隐藏和显示系统栏
【发布时间】:2013-04-02 13:11:06
【问题描述】:

我需要在我的应用程序中显示和隐藏系统栏,因此我使用了两个按钮。我曾经测试过 Android (3.0.1) 和 Android (4.1.1) 设备。对于 Android (3.0.1),我可以根据我的要求隐藏和显示系统栏。但在 Android (4.1.1) 中,按钮无法隐藏和显示系统栏。

我的代码是

// Showing system bar
    showSystemBarBtn.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {

            try {
                Process proc = Runtime.getRuntime().exec(new String[]{"am","startservice","-n","com.android.systemui/.SystemUIService"});
                proc.waitFor();
            } catch(Exception e) {
                e.printStackTrace();
            }
        }
    });

    // Hiding System bar
    hideSystemBarBtn.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {

            try {
                Process proc = Runtime.getRuntime().exec(new String[]{"su","-c","service call activity 79 s16 com.android.systemui"});
                proc.waitFor();
            } catch(Exception e){
                e.printStackTrace();
            }
        }
    });

我该如何解决这个问题?

【问题讨论】:

标签: android performance statusbar android-notifications android-theme


【解决方案1】:

为了隐藏:

Process proc = Runtime.getRuntime().exec(new String[]{"su","-c","service call activity 79 s16 com.android.systemui"});

" 尝试将“79”更改为“42”。

在引入 ICS 时,SystemUI 类的进程 ID 从 79 更改为 42。

【讨论】:

  • 如果你能解释一下 79 和 42 的区别会很有帮助。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-12-07
  • 1970-01-01
  • 1970-01-01
  • 2013-09-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多