本文介绍了是否有可能隐藏系统栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个发射器,使用它在内部应用程序。对于一些安全原因,我想隐藏系统栏(存取权限参数的ordrer的存取权限安装的应用程序)。但我不知道如何做到这一点。片剂将用于不生根。你能帮助我吗?

I created a launcher, to use it in an internal application. for some security reasons i would like to hide the system bar (the acces to the parameter an ordrer to the acces to installed application). But i have no idea how to do this.Tablet that will be used are not rooted.Can you help me please?

推荐答案

您不能隐藏它,但你可以禁用它,除非家里。对于那些你可以给你的应用程序作为家庭类和让用户选择。

You can't hide it but you can disable it, except home. For that you can give your application as home category and let the user choose.

<category android:name="android.intent.category.HOME" />

休息都可以禁用。

Rest all can be disable.

在清单中添加此。

<uses-permission android:name="android.permission.EXPAND_STATUS_BAR"/>

里面的onCreate()

inside onCreate()

this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_home);
    View v = findViewById(R.id.home_view);
    v.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);

在这里home_view是xml文件的父视图。

where home_view is the parent view of xml file.

 @Override
     public boolean onKeyDown(int keyCode, KeyEvent event) {
            return false;
        }

 public void onWindowFocusChanged(boolean hasFocus)
     {
             try
             {
                if(!hasFocus)
                {
                     Object service  = getSystemService("statusbar");
                     Class<?> statusbarManager = Class.forName("android.app.StatusBarManager");
                     Method collapse = statusbarManager.getMethod("collapse");
                     collapse .setAccessible(true);
                     collapse .invoke(service);
                }
             }
             catch(Exception ex)
             {
             }
     }

这篇关于是否有可能隐藏系统栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 07:12