隐藏系统栏的果冻豆平板电脑(扎根) [英] Hide System Bar in Jelly Bean Tablet (Rooted)

查看:160
本文介绍了隐藏系统栏的果冻豆平板电脑(扎根)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Android果冻豆平板电脑已经扎根,并尝试运行它具有code隐藏系统栏中的应用程序,但它没有得到隐藏的任何一个可以帮助我在此。

I have an Android Jelly Bean Tablet which has been rooted and trying to run an application which has the code to hide the system bar but it's not getting hidden can any one help me out on this.

获取终端输出:结果包裹(00000000'....')

public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button hide=(Button)findViewById(R.id.button1);
        Button show=(Button)findViewById(R.id.button2);
        hide.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                 Log.v("ds", "hideSystembar");
                    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();
                    }
            }
        });
        show.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                  Log.v("f", "showSystembar");
                    try {
                        Process proc = Runtime.getRuntime().exec(new String[]{
                                "am","startservice","-n","com.android.systemui/.SystemUIService"});
                        proc.waitFor();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
            }
        });
    }
} 

虽然我得到许可的授予敬酒:

Though I am getting toast of permission granted :

超级用户登录屏幕截图:

Super User Log Screen Shot:

推荐答案

进程ID为 SystemUI 类从79改为42 ICS被推出的时候。
下面的code适用于任何版本的Andr​​oid您的应用程序可能运行在。

The process id for the SystemUI class changed from 79 to 42 when ICS was introduced.
The code below works for any version of Android that your app might be running on.

//HIDE TOOLBAR
try{
    //REQUIRES ROOT
    Build.VERSION_CODES vc = new Build.VERSION_CODES();
    Build.VERSION vr = new Build.VERSION();
    String ProcID = "79"; //HONEYCOMB AND OLDER

    //v.RELEASE  //4.0.3
    if(vr.SDK_INT >= vc.ICE_CREAM_SANDWICH){
        ProcID = "42"; //ICS AND NEWER
    }

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

}catch(Exception ex){
    Toast.makeText(getApplicationContext(), ex.getMessage(), Toast.LENGTH_LONG).show();
}

这篇关于隐藏系统栏的果冻豆平板电脑(扎根)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆