如何在Android平板电脑中隐藏底部系统栏 [英] How to hide bottom system bar in android tablet

查看:531
本文介绍了如何在Android平板电脑中隐藏底部系统栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我仅在平板电脑上开发应用程序,要求在平板电脑的全屏上运行该应用程序.

I am developing an application for tablet only, where the requirement is to run the app on the full screen of the tablet.

为此,我在主要活动中使用了以下代码:

For this I have used following code in my main activity:

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

此代码段仅删除标题栏和操作栏.但是在平板电脑中,有一个底部的系统栏(具有返回"和返回"按钮).我也想删除或隐藏此系统栏.

This code snippet only removes the title bar and action bar. But in tablets, there is a bottom system bar (having home and back button). I also want to remove or hide this system bar too.

我已经搜索过,但是只有以下解决方案:

I have searched but there is only following solution:

  1. 没有用于删除或隐藏系统栏的API.
  2. 您可以使用一些android应用程序来隐藏系统栏. (例如: 确保锁定,隐藏栏等)
  1. There is no API to remove or hide the system bar.
  2. You can use some android app to hide system bar. (for example: surelock, hidebar, etc)

我的问题是:

  1. 在Android中真的不可能吗?
  2. 以上可用的应用程序(例如,surelock,隐藏栏等)也隐藏了栏. 这意味着他们正在使用某种方法来这样做.可以用这个 我们应用中的某些内容,因此用户无需下载这些内容 单独应用.
  1. Is it really not possible in android?
  2. Above available app (i.e surelock, hide bar, etc) also hiding bar. It means they are using something to do so. Can be use this something in our app so the user will not require to download these app seperatly.

请指导我.

我知道这不是一个好主意.但是我的应用程序仅适用于具有Android 4.0或更高版本的平板电脑,并且平板电脑只能运行该单个应用程序,因此我们无需返回并使用主页按钮.这就是为什么我的要求是使用该应用程序全屏显示.

I know this is not a good idea. But My app is only for tablet having Android 4.0 or greater and that tablet will run only this single app so we do not need to go back and use home button. That's why my requirement is to use the app in full screen.

推荐答案

如果您具有root用户访问权限,则可以以其他方式使用此代码,不允许这样做

If you have root access you can use this code other wise it is not allowed

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();
}

查看此

这篇关于如何在Android平板电脑中隐藏底部系统栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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