如何防止状态栏和导航显示?
How do I prevent the Status Bar and Navigation from ever showing?
这里已经有类似的问题了,虽然我想做的很相似但并不相同,所以请不要标记为重复。
我正在为 Kiosk 上 运行 开发一个应用程序,因此我想阻止用户退出该应用程序,为此我需要隐藏状态栏和导航栏。
我可以做到这两点,但总有一种方法可以让用户将它们带回来,这不是理想的结果。
到目前为止我有:
- 阅读on/trialled可以在其中使用的属性
setSystemUiVisibility()
.
- 用
InputMethodManager
进行了实验
- 研究了不同的全屏选项沉浸式、粘性沉浸式
向后靠。
- 查看了可以在清单文件中设置的属性。
- 浏览了文档。
- 用 Google 搜索类似问题。
理想的解决方案是我不必为每个 activity..
重复相同的设置
似乎喜欢我正在寻找的 behaviour/functionality 包含在 Android 所指的 Dedicated Device:
中
Dedicated devices
As an IT admin, you can configure Android 6.0
Marshmallow and later devices as dedicated devices (previously called
corporate-owned, single-use, or COSU devices). These are Android
devices used for a single purpose, such as digital signage, ticket
printing, point of sale, or inventory management. To use Android
devices as dedicated devices, you need to develop Android apps that
your customers can manage.
Your customers can configure dedicated devices:
- To lock a single application to the screen, and hide the Home and
Recents buttons to prevent users from escaping the app.
- To allow multiple applications to appear on the screen, such as a library kiosk
with a catalog app and web browser.
因此,考虑到它是为此特定目的而设计的,最好利用它,而不是尝试 emulate/mimic 这种行为,到目前为止,这似乎是不可能的。
这里已经有类似的问题了,虽然我想做的很相似但并不相同,所以请不要标记为重复。
我正在为 Kiosk 上 运行 开发一个应用程序,因此我想阻止用户退出该应用程序,为此我需要隐藏状态栏和导航栏。
我可以做到这两点,但总有一种方法可以让用户将它们带回来,这不是理想的结果。
到目前为止我有:
- 阅读on/trialled可以在其中使用的属性
setSystemUiVisibility()
. - 用
InputMethodManager
进行了实验
- 研究了不同的全屏选项沉浸式、粘性沉浸式 向后靠。
- 查看了可以在清单文件中设置的属性。
- 浏览了文档。
- 用 Google 搜索类似问题。
理想的解决方案是我不必为每个 activity..
重复相同的设置似乎喜欢我正在寻找的 behaviour/functionality 包含在 Android 所指的 Dedicated Device:
中Dedicated devices
As an IT admin, you can configure Android 6.0 Marshmallow and later devices as dedicated devices (previously called corporate-owned, single-use, or COSU devices). These are Android devices used for a single purpose, such as digital signage, ticket printing, point of sale, or inventory management. To use Android devices as dedicated devices, you need to develop Android apps that your customers can manage.
Your customers can configure dedicated devices:
- To lock a single application to the screen, and hide the Home and Recents buttons to prevent users from escaping the app.
- To allow multiple applications to appear on the screen, such as a library kiosk with a catalog app and web browser.
因此,考虑到它是为此特定目的而设计的,最好利用它,而不是尝试 emulate/mimic 这种行为,到目前为止,这似乎是不可能的。