gpt4 book ai didi

Android 平板电脑 - 触摸时隐藏/显示状态栏

转载 作者:搜寻专家 更新时间:2023-11-01 08:02:48 24 4
gpt4 key购买 nike

我一直在上下搜索如何在 Android 平板电脑上隐藏状态栏。我知道除非您对平板电脑进行 root,否则不可能这样做。

我遇到的主要问题是,当我在我的应用程序上写字时,会弹出 wi-fi 部分。

我知道标志 View.SYSTEM_UI_FLAG_HIDE_NAVIGATION 或 SYSTEM_UI_FLAG_LOW_PROFILE隐藏导航/模糊导航。

我需要的是:Gallery 应用程序(内置于 android)中有一个功能,可让您遍历图像,并且仅在单点触摸时弹出导航并在单点触摸时隐藏。没有其他手势触发此栏。

我需要一些方法来实现类似的东西。

如果有人能指出正确的方向,我将不胜感激。

详细信息:

平板电脑:三星 Galaxy Note 10.1安卓版本:4.1.2

最佳答案

实际上在 4+ Android 版本的平板电脑中是不可能隐藏它的,但你可以尝试像 this 那样做。 :

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.

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

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. You can set each of these flags for the system bar and navigation bar by calling setSystemUiVisibility() on any view in your activity. The window manager combines (OR-together) all flags from all views in your window and apply them to the system UI as long as your window has input focus. When your window loses input focus (the user navigates away from your app, or a dialog appears), your flags cease to have effect. Similarly, if you remove those views from the view hierarchy their flags no longer apply.

我找到的另一个解决方案是像这样为您的布局 View 提供服务:

yourView.setSystemUiVisibility(8);

他们说它适用于平板电脑,但我还没有真正尝试过。

另一个正在添加this方法并根据您要显示的内容传递 True 或 False:

 void setNavVisibility(boolean visible) {
int newVis = mBaseSystemUiVisibility;
if (!visible) {
newVis |= SYSTEM_UI_FLAG_LOW_PROFILE | SYSTEM_UI_FLAG_FULLSCREEN;
}
final boolean changed = newVis == getSystemUiVisibility();

// Unschedule any pending event to hide navigation if we are
// changing the visibility, or making the UI visible.
if (changed || visible) {
Handler h = getHandler();
if (h != null) {
h.removeCallbacks(mNavHider);
}
}

// Set the new desired visibility.
setSystemUiVisibility(newVis);
mTitleView.setVisibility(visible ? VISIBLE : INVISIBLE);
mSeekView.setVisibility(visible ? VISIBLE : INVISIBLE);
}

关于Android 平板电脑 - 触摸时隐藏/显示状态栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18653783/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com