- 浏览: 157027 次
- 性别:
- 来自: 深圳
最新评论
-
dawei1980:
请问,解压密码是多少?
Android本地APP集成Mui框架 -
牧羊之人:
Android本地APP集成Mui框架 -
还有也许:
貌似懂了一点。如果onCreate方法中创建了一个db,然后在 ...
Android线程模式(handler,thread,looper) -
chenshijun0101:
header里面怎么更改他的样式呢?急求
android Preference相关样式修改 -
qlraishui:
good
Binder机制分析【三】-service绑定Binder
Controls for system UI visibility
Since the early days of Android, the system has managed a UI component known as the status bar, which resides at the top of handset devices to deliver information such as the carrier signal, time, notifications, and so on. Android 3.0 added the system bar for tablet devices, which resides at the bottom of the screen to provide system navigation controls (Home, Back, and so forth) and also an interface for elements traditionally provided by the status bar. In Android 4.0, the system provides a new type of system UI called the navigation bar. You might consider the navigation bar a re-tuned version of the system bar designed for handsets—it provides navigation controls for devices that don’t have hardware counterparts for navigating the system, but it leaves out the system bar's notification UI and setting controls. As such, a device that provides the navigation bar also has the status bar at the top.
To this day, you can hide the status bar on handsets using the FLAG_FULLSCREEN flag. In Android 4.0, the APIs that control the system bar’s visibility have been updated to better reflect the behavior of both the system bar and navigation bar:
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.
To synchronize other events in your activity with visibility changes to the system UI (for example, hide the action bar or other UI controls when the system UI hides), you should register a View.OnSystemUiVisibilityChangeListener to be notified when the visibility of the system bar or navigation bar changes.
See the OverscanActivity class for a demonstration of different system UI options.
控制导航栏的显示有两种修改方法:
1.临时修改,通过方法mView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION)方法设置。注意该方法必须放在setContentView(mView)之前,具体代码如下:
2.永久隐藏法。修改系统文件/framework/base/core/res/res/values/config.xml的变量config_showNavigationBar值。如果不起作用,那就是该值被android.content.res.Configuration类的变量navigationHidden所取代,需要修改此值(搜索SystemUI得知,显示导航栏与否是通过方法mWindowManagerService.hasNavigationBar()判断的,该方法的实现是在PhoneWindowManager类里面mHasNavigationBar设置的。)
Since the early days of Android, the system has managed a UI component known as the status bar, which resides at the top of handset devices to deliver information such as the carrier signal, time, notifications, and so on. Android 3.0 added the system bar for tablet devices, which resides at the bottom of the screen to provide system navigation controls (Home, Back, and so forth) and also an interface for elements traditionally provided by the status bar. In Android 4.0, the system provides a new type of system UI called the navigation bar. You might consider the navigation bar a re-tuned version of the system bar designed for handsets—it provides navigation controls for devices that don’t have hardware counterparts for navigating the system, but it leaves out the system bar's notification UI and setting controls. As such, a device that provides the navigation bar also has the status bar at the top.
To this day, you can hide the status bar on handsets using the FLAG_FULLSCREEN flag. In Android 4.0, the APIs that control the system bar’s visibility have been updated to better reflect the behavior of both the system bar and navigation bar:
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.
To synchronize other events in your activity with visibility changes to the system UI (for example, hide the action bar or other UI controls when the system UI hides), you should register a View.OnSystemUiVisibilityChangeListener to be notified when the visibility of the system bar or navigation bar changes.
See the OverscanActivity class for a demonstration of different system UI options.
控制导航栏的显示有两种修改方法:
1.临时修改,通过方法mView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION)方法设置。注意该方法必须放在setContentView(mView)之前,具体代码如下:
public class HideTestActivity extends Activity implements OnClickListener{ View main ; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); main = getLayoutInflater().from(this).inflate(R.layout.main, null); main.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); main.setOnClickListener(this); setContentView(main); } @Override public void onClick(View v) { int i = main.getSystemUiVisibility(); if (i == View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) { main.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE); } else if (i == View.SYSTEM_UI_FLAG_VISIBLE){ main.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE); } else if (i == View.SYSTEM_UI_FLAG_LOW_PROFILE) { main.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); } } }
2.永久隐藏法。修改系统文件/framework/base/core/res/res/values/config.xml的变量config_showNavigationBar值。如果不起作用,那就是该值被android.content.res.Configuration类的变量navigationHidden所取代,需要修改此值(搜索SystemUI得知,显示导航栏与否是通过方法mWindowManagerService.hasNavigationBar()判断的,该方法的实现是在PhoneWindowManager类里面mHasNavigationBar设置的。)
发表评论
-
判断图片是浅色还是深色
2020-03-04 13:23 790首先需要获取 WallpaperManager.FLAG_L ... -
如何将uri转成真实路径地址
2018-10-15 17:38 1196/** * 获取文件选择器选中的文 ... -
备用网址记录
2018-01-08 11:05 430各种开源下载 http://www.mvnjar.com/ ... -
android中touch事件,click事件,longclick事件分析
2016-08-03 15:51 1495针对屏幕上的一个View控件,Android如何区分应当触发o ... -
Android 快速开发系列 打造万能的ListView GridView 适配器
2016-06-27 17:21 675前往 http://blog.csdn.net/lmj6235 ... -
android中的Handler和AsyncTask如何防止内存泄露
2016-06-13 13:55 1634Handler泄露的关键点有两个: 1). 内部类 ... -
[转载]SharedPreferences 存储java对象,很实用
2016-04-14 16:36 1056public void putObject(String ke ... -
Android本地APP集成Mui框架
2016-01-26 14:41 31322.如何在安卓原生APP中 ... -
Android与设计模式浅谈
2015-04-27 10:42 1082Android作为新一代的操作系统,集合着Google ... -
从网页启动Activity
2015-03-24 11:28 1366正好Android SDK 给我们提供了解决方案,在网页中点击 ... -
[转]android shape的使用
2014-10-13 13:30 760shape用于设定形状,可以在selector,layout等 ... -
touch事件分发处理流程
2014-05-23 09:44 817Touch 事件发生时 Activity 的 dispatch ... -
修改标准GSensor相关,是重力感应游戏在平板都可以玩
2013-12-21 11:27 852为什么有些重力感应的游戏不能玩,有些可以玩,主要原因在于fra ... -
Android模拟按键
2013-10-14 14:27 2405如果想要实现类似iphone的悬浮框按钮,那就必须知道如何去模 ... -
android资源适配解析及资源适配优先级规则
2013-10-12 12:41 36731.sw的值是怎么计算得来 ... -
【转】解决Android与服务器交互大容量数据问题
2013-09-02 14:40 2055对于目前的状况来说, ... -
[转载]Android大图裁剪解决办法
2013-04-25 14:29 2129cropimage 可以调用手机自带的com.android ... -
反锯齿办法
2012-12-28 14:14 951在Android中,目前,我知道有两种出现锯齿的情况。 ① ... -
android线程的那些事
2012-11-17 15:36 2313有些时候Thread里面更新UI是可以成功的。 比如在Acti ... -
图像缩放和旋转
2012-11-16 11:20 1196在绘制bitmap时,都会涉及一个参数矩阵Matrix,Mat ...
相关推荐
0001-导航栏添加按钮隐藏虚拟按键,上滑调出虚拟按键
4. 隐藏虚拟按键:虚拟按键,也称为导航栏,包括返回、主页和多任务按钮。使用以下命令可以隐藏虚拟按键: ``` adb shell input keyevent 82 ``` 这个命令模拟按下菜单键,从而隐藏虚拟按键。若要重新显示,...
调用`getWindow().getDecorView()`获取到当前Activity的装饰视图,然后调用`setSystemUiVisibility()`方法,传入`View.SYSTEM_UI_FLAG_HIDE_NAVIGATION`标志来隐藏虚拟按键。 ```java // 隐藏虚拟按键 decorView....
【GMD自动隐藏虚拟按键专业版】是一款专为Android设备设计的应用程序,旨在提供更加纯净、无干扰的屏幕体验。该应用的主要功能是隐藏设备底部的系统导航栏,即我们通常所说的“虚拟按键”,如返回、主页和多任务键。...
### 隐藏、显示导航栏(虚拟按键)...通过上述详细解析,我们可以了解到Android系统中隐藏和显示导航栏(虚拟按键)的具体实现方法及其背后的原理。这对于希望优化应用界面交互体验的开发者来说是非常有用的参考资料。
在Android 4.4(KitKat)版本中引入了全屏沉浸模式,通过`SYSTEM_UI_FLAG_HIDE_NAVIGATION`和`SYSTEM_UI_FLAG_FULLSCREEN`这两个系统UI标志位,可以隐藏底部导航栏和顶部状态栏,让应用界面充满整个屏幕。...
- 在Activity的`onCreate()`方法中,获取到`Window`对象,并调用`setFlags()`方法,传递`SYSTEM_UI_FLAG_HIDE_NAVIGATION`标志,隐藏虚拟按键。 - 注意:隐藏后,用户可能无法快速返回主界面,因此需要监听`SYSTEM...
在安卓P(Android P)系统中,动态隐藏虚拟按键是一项重要的功能优化,它允许开发者或者用户根据应用的需求或个人偏好来控制导航栏的可见性。这项功能主要涉及到系统的UI交互和自定义设置,提升了用户体验,特别是在...
此功能主要添加frameworks\base\services的功能在此目录下请搜索FEATURE_AUTO_HIDE_NAVIGATIONBAR,frameworks\base\packages\SystemUI下按键添加,需要...隐藏后需要显示导航栏请从下往上滑动,此功能只针对虚拟按键
这个压缩包文件"安卓消息推送通知栏相关-去除标题去除状态栏和隐藏虚拟按键.rar"似乎包含了一些实现特定UI效果的代码示例,主要目标是使应用在全屏模式下运行时更加沉浸式,即去除标题、状态栏以及隐藏虚拟按键。...
5. **判断虚拟按键状态**:利用`DisplayMetrics`和`View`类提供的方法,可以检测当前设备是否存在底部虚拟按键,以及其尺寸。这样可以针对性地处理布局,确保在各种设备上表现一致。 6. **Jetpack Compose适配**:...
// 隐藏虚拟按键 decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); // 再次检查 // assertNoOverlap(videoPlayer.getVideoView(), decorView.findViewById(android.R.id....
首先,隐藏虚拟按键主要通过调用`View`类的`setSystemUiVisibility()`方法来实现。在`MainActivity`的`onCreate()`方法中,我们可以添加以下代码: ```java @Override protected void onCreate(Bundle icicle) { ...
本文将详细介绍如何在Android开发中实现去除标题、去除状态栏以及隐藏虚拟按键的操作。 首先,我们来看如何隐藏标题。在Android应用中,标题通常是由ActionBar或者Toolbar提供的。如果你使用的是Android Studio,...
对于普通应用,通常需要依赖API提供的方法,如在Android 4.4及以上版本中使用`SYSTEM_UI_FLAG_HIDE_NAVIGATION`或`SYSTEM_UI_FLAG_IMMERSIVE_STICKY`等标志来隐藏虚拟按键。但这种方法并不能完全去除虚拟按键,用户...
- 对于需要隐藏虚拟键的设备,没有处理好硬件按键的隐藏逻辑。 - 在配置更改后(如屏幕旋转)没有重新设置沉浸式状态。 解决白屏问题的步骤可能包括: 1. **检查权限**:确保应用有正确的权限,如`android....
但是,单纯地隐藏虚拟按键可能会引发其他问题,比如手动隐藏后出现长白条区域、状态栏隐藏后虚拟按键不随之隐藏,以及在无虚拟按键设备上影响SurfaceView的全屏显示等。 在解决这些问题的过程中,关键在于正确地...
例如,使用以下代码隐藏虚拟按键: ```java View decorView = UnityPlayer.currentActivity.getWindow().getDecorView(); int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; decorView....
此段js代码完美解决 ; (function () { try { isIOS = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) if (fn.isIOS) { // window.history.pushState({}, title, #);... document.addEventListener...