当前位置:网站首页>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);
边栏推荐
- 面试突击69:TCP 可靠吗?为什么?
- 【Acwing】The 62nd Weekly Game Solution
- 新产品如何进行网络推广?
- SQL injection Less47 (error injection) and Less49 (time blind injection)
- 网易云信圈组上线实时互动频道,「破冰」弱关系社交
- @JsonFormat(pattern=“yyyy-MM-dd“)时间差问题
- IJCAI2022 | 代数和逻辑约束的混合概率推理
- 一体化步进电机在无人机自动机场的应用
- 编写方法将一个数组扁平化并且去重和递增排序
- How to Design High Availability and High Performance Middleware - Homework
猜你喜欢
[Cloud Residency Co-Creation] [HCSD Big Celebrity Live Broadcast] Personally teach the secrets of interviews in big factories
Drawing process of hand-drawn map of scenic spots
程序进程和线程(线程的并发与并行)以及线程的基本创建和使用
如何设计高可用高性能中间件 - 作业
一文带你了解 Grafana 最新开源项目 Mimir 的前世今生
How to reduce the gap between software design and implementation
Shell常用脚本:Nexus批量上传本地仓库增强版脚本(强烈推荐)
手写一个简单的web服务器(B/S架构)
推荐系统:常用评价指标总结【准确率、精确率、召回率、命中率、(归一化折损累计增益)NDCG、平均倒数排名(MRR)、ROC曲线、AUC(ROC曲线下的面积)、P-R曲线、A/B测试】
【1161. 最大层内元素和】
随机推荐
力扣2326、197
网络安全--通过握手包破解WiFi(详细教程)
vim的基本使用-命令模式
消息队列消息存储设计(架构实战营 模块八作业)
/etc/sysconfig/network-scripts configure the network card
Input and output optimization
新产品如何进行网络推广?
The uniapp applet checks and prompts for updates
Basic use of vim - bottom line mode
How to import a Golang external package and use it?
Flutter教程之 01配置环境并运行demo程序 (教程含源码)
输入输出优化
【读书笔记->数据分析】02 数据分析准备
SQL injection Less46 (injection after order by + rand() Boolean blind injection)
UOS统信系统 - WindTerm使用
The difference between adding or not adding the ref keyword when a variable of reference type is used as a parameter in a method call in C#
SQL injection Less54 (limited number of SQL injection + union injection)
Shell common scripts: Nexus batch upload local warehouse enhanced version script (strongly recommended)
Advanced Algebra _ Proof _ Any matrix is similar to an upper triangular matrix
Usage of mysql having