简体   繁体   中英

Hide navigation bar?

I am on android 6. Looking for solutiong where I can hide and disable nav bar with soft keys(home, back, recent). On a google page (COSU IMPLEMENTATION) there is a picture comparing pinning and lock task modes, and on the right side we can see options looks like "Home and Recent buttons are hidden", prior to pin mode. But I didnt find any method to do it. I already locked an activity, but still can call nav bar with swipe up. Maybe someone here knows it.

Ok. For everybody who faces. Its impossible to hide navigation bar at all. On a google web page we can see only "HOME AND RECENT BUTTONS ARE HIDDEN", but not the BACK button. So for now with startLockTask() method we can hide everything BUT BACK button. Also disabling status bar it wont be invisible. You can still call it with swipe but there are nothing on it.

You no longer need to implement a Device Policy Controller to manage Android devices, Google has recently released the Android Management API which allows you to set up a COSU device with just a few Cloud API calls.

To lock the device on one app, or on multiple app, you define a kiosk policy like below, it will disable the navigation buttons (sample copied from Create a policy ). And in addition you can set statusBarDisabled to disable the status bar and other overlays that could allow to escape your app.

"applications": [
 {
   "packageName": "com.example.app",
   "installType": "FORCE_INSTALLED",
   "lockTaskAllowed": true,
   "defaultPermissionPolicy": "GRANT",
 },
"persistentPreferredActivities": [
  {
    "receiverActivity": "com.example.app/.com.example.app.MainActivity",
    "actions": [
      "android.intent.action.MAIN"
    ],
    "categories": [
      "android.intent.category.HOME",
      "android.intent.category.DEFAULT"
    ]
  }
],
"statusBarDisabled": true

您可以看到官方文档,向您展示如何隐藏导航栏: 官方Android文档

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM