当前位置:网站首页>WindowInsetsControllerCompat简单使用
WindowInsetsControllerCompat简单使用
2022-07-31 23:53:00 【东东旭huster】
WindowInsetsControllerCompat,主要可以用来控制界面中导航栏,状态栏,键盘等这些地方的显示,大概有以下的类型。
WindowInsetsCompat.Type.statusBars()
WindowInsetsCompat.Type.navigationBars()
WindowInsetsCompat.Type.captionBar()
WindowInsetsCompat.Type.ime()
WindowInsetsCompat.Type.systemGestures()
WindowInsetsCompat.Type.mandatorySystemGestures()
WindowInsetsCompat.Type.tappableElement()
WindowInsetsCompat.Type.displayCutout()
WindowInsetsCompat.Type.systemBars()
导入依赖
implementation ‘androidx.core:core:1.5.0-beta03’
使用方式
WindowInsetsControllerCompat insetsController = ViewCompat.getWindowInsetsController(getWindow().getDecorView());
// 隐藏状态栏、导航栏、标题栏
insetsController.hide(WindowInsetsCompat.Type.systemBars());
// 显示状态栏、导航栏、标题栏
insetsController.show(WindowInsetsCompat.Type.systemBars());
// 隐藏导航栏
insetsController.hide(WindowInsetsCompat.Type.navigationBars());
// 显示导航栏
insetsController.show(WindowInsetsCompat.Type.navigationBars());
// 显示状态栏
insetsController.show(WindowInsetsCompat.Type.statusBars());
//隐藏状态栏
insetsController.hide(WindowInsetsCompat.Type.statusBars());
// 显示键盘
insetsController.show(WindowInsetsCompat.Type.ime());
// 隐藏键盘
insetsController.hide(WindowInsetsCompat.Type.ime());
// ...
// 控制状态栏字体颜色显示为白色
insetsController.setAppearanceLightStatusBars(false);
// 控制导航栏字体显示为黑色
insetsController.setAppearanceLightStatusBars(true);
// 导航栏颜色显示为白色
insetsController.setAppearanceLightNavigationBars(false);
// 导航栏显示为黑色
insetsController.setAppearanceLightNavigationBars(true);
边栏推荐
- 新产品如何进行网络推广?
- SVN服务器搭建+SVN客户端+TeamCity集成环境搭建+VS2019开发
- 逐步手撕轮播图3(保姆级教程)
- [MATLAB project combat] LDPC-BP channel coding
- 高等代数_证明_任何矩阵都相似于一个上三角矩阵
- 【1161. 最大层内元素和】
- 面试突击69:TCP 可靠吗?为什么?
- [QNX Hypervisor 2.2 User Manual]9.16 system
- Recommendation system: Summary of common evaluation indicators [accuracy rate, precision rate, recall rate, hit rate, (normalized depreciation cumulative gain) NDCG, mean reciprocal ranking (MRR), ROC
- 22年8月推广大使额外奖励规则
猜你喜欢
面试突击69:TCP 可靠吗?为什么?
Google Earth Engine——Error: Image.clipToBoundsAndScale, argument ‘input‘: Invalid type的错误解决
消息队列存储消息数据的MySQL表格
Shell常用脚本:Nexus批量上传本地仓库脚本
基于单片机GSM的防火防盗系统的设计
A high-quality WordPress download site template theme developed abroad
UOS统信系统 - WindTerm使用
Network security - crack WiFi through handshake packets (detailed tutorial)
Recommendation system: Summary of common evaluation indicators [accuracy rate, precision rate, recall rate, hit rate, (normalized depreciation cumulative gain) NDCG, mean reciprocal ranking (MRR), ROC
高等代数_证明_任何矩阵都相似于一个上三角矩阵
随机推荐
NIO programming
基于单片机GSM的防火防盗系统的设计
Keil nRF52832下载失败
标段参数说明
输入输出优化
SQL injection Less54 (limited number of SQL injection + union injection)
How to reduce the gap between software design and implementation
网络安全--通过握手包破解WiFi(详细教程)
面试突击69:TCP 可靠吗?为什么?
内核对设备树的处理
ICML2022 | 深入研究置换敏感的图神经网络
Interview Blitz 69: Is TCP Reliable?Why?
I don't know what to do with sync issues
How to Design High Availability and High Performance Middleware - Homework
简单的vim配置
Shell common script: Nexus batch upload local warehouse script
EntityFramework保存到SQLServer 小数精度丢失
数据分析(一)——matplotlib
What is customer profile management?
IPD流程专业术语