当前位置:网站首页>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);
边栏推荐
- Flutter教程之四年开发经验的高手给的建议
- 输入输出优化
- vector的基本实现
- SVN server construction + SVN client + TeamCity integrated environment construction + VS2019 development
- 2022年CSP-J1 CSP-S1 第1轮初赛 报名指南
- Difference between first and take(1) operators in NgRx
- 基于mysql的消息队列设计
- Named Entity Recognition - Model: BERT-MRC
- LeetCode 第 304 场周赛
- Payment module implementation
猜你喜欢
![[1161. The maximum sum of elements in the layer]](/img/59/7810f425431779aa719458038ea0b3.png)
[1161. The maximum sum of elements in the layer]

【读书笔记->数据分析】02 数据分析准备

IJCAI2022 | 代数和逻辑约束的混合概率推理
![[MATLAB project combat] LDPC-BP channel coding](/img/37/4777e4d05cb2dbb1865f1d05ae9878.png)
[MATLAB project combat] LDPC-BP channel coding

基于mysql的消息队列设计

cobaltstrike

C# Rectangle basic usage and picture cutting

Shell common scripts: Nexus batch upload local warehouse enhanced version script (strongly recommended)
SQL27 View user details of different age groups

One line of code to solve CoreData managed object properties change in SwiftUI problem of animation effects
随机推荐
How to Design High Availability and High Performance Middleware - Homework
开源好用的 流程图绘制工具 drawio
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#
I don't know what to do with sync issues
Drawing process of hand-drawn map of scenic spots
The uniapp applet checks and prompts for updates
力扣二叉树
[1161. The maximum sum of elements in the layer]
A high-quality WordPress download site template theme developed abroad
Advanced Algebra _ Proof _ Any matrix is similar to an upper triangular matrix
无状态与有状态的区别
mysql having的用法
MySQL数据库‘反斜杠\’ ,‘单引号‘’,‘双引号“’,‘null’无法存储
SQL injection Less47 (error injection) and Less49 (time blind injection)
Shell常用脚本:Nexus批量上传本地仓库脚本
The role of /etc/resolv.conf
"APIO2010" Patrol Problem Solution
高等代数_证明_任何矩阵都相似于一个上三角矩阵
/etc/resolv.conf的作用
Pytest first experience