如何隐藏在Android手机的软键栏? [英] How to hide the soft-key bar on Android phone?

查看:159
本文介绍了如何隐藏在Android手机的软键栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 

在我的应用程序启动时,我想隐藏软键栏(红色矩形)有一个更大的屏幕。

When my app starts, I'd like to hide the soft keys bar (in red rectangle) to have a larger screen.

  1. 如何隐藏呢?

  1. How can I hide it?

我是否需要特意显示栏时,应用程序退出?或者,它会自动应用程序退出后自行恢复?

Do I need to show the bar purposely when the app quits? Or it will restore itself automatically after the app quits?

安卓4.1,对手机正面没有任何硬件按键。

Android 4.1, with no hardware keys on phone front.

推荐答案

尝试

getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

从官方 DOC

在SYSTEM_UI_FLAG_LOW_PROFILE标志取代了STATUS_BAR_HIDDEN   旗。当设置,此标志,低调模式的系统   酒吧或导航栏。导航按钮暗淡和其他元素   系统栏也隐藏。启用,这是创造更多有用   身临其境的游戏没有分心系统导航按钮。

The SYSTEM_UI_FLAG_LOW_PROFILE flag replaces the STATUS_BAR_HIDDEN flag. When set, this flag enables "low profile" mode for the system bar or navigation bar. Navigation buttons dim and other elements in the system bar also hide. Enabling this is useful for creating more immersive games without distraction for the system navigation buttons.

在SYSTEM_UI_FLAG_VISIBLE标志取代了STATUS_BAR_VISIBLE标志   要求系统栏或导航栏是可见的。

The SYSTEM_UI_FLAG_VISIBLE flag replaces the STATUS_BAR_VISIBLE flag to request the system bar or navigation bar be visible.

该SYSTEM_UI_FLAG_HIDE_NAVIGATION是一个新的标志要求   导航栏隐藏完全。请注意,这仅适用于该   被一些手机导航条(不隐藏系统   酒吧平板电脑)。导航栏返回尽快观为   系统接收用户输入。因此,主要是为这个模式是有用   视频播放或在整个屏幕是必要的其他情况,但   不需要用户输入。

The SYSTEM_UI_FLAG_HIDE_NAVIGATION is a new flag that requests the navigation bar hide completely. Be aware that this works only for the navigation bar used by some handsets (it does not hide the system bar on tablets). The navigation bar returns to view as soon as the system receives user input. As such, this mode is useful primarily for video playback or other cases in which the whole screen is needed but user input is not required.

导航栏的行为是应用程序依赖IIRC,所以应该再次显示在用户离开您的应用程序后。

The behavior of the nav bar is app dependent IIRC, so it should show again after the user leaves your app.

这篇关于如何隐藏在Android手机的软键栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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