当前位置:网站首页>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);
边栏推荐
- "APIO2010" Patrol Problem Solution
- Design of Fire and Anti-theft System Based on Single Chip GSM
- thymeleaf迭代map集合
- 输入输出优化
- 消息队列存储消息数据的MySQL表格
- 基于simulink的Active anti-islanding-AFD主动反孤岛模型仿真
- TFC CTF 2022 WEB Diamand WriteUp
- SQL injection Less46 (injection after order by + rand() Boolean blind injection)
- Components of TypeScript
- 【MATLAB项目实战】LDPC-BP信道编码
猜你喜欢
UOS - WindTerm use
NIO编程
What is customer profile management?
I don't know what to do with sync issues
Handwritten a simple web server (B/S architecture)
程序进程和线程(线程的并发与并行)以及线程的基本创建和使用
Binary tree non-recursive traversal
SQL27 View user details of different age groups
【MATLAB项目实战】LDPC-BP信道编码
/etc/sysconfig/network-scripts 配置网卡
随机推荐
SQL注入 Less47(报错注入) 和Less49(时间盲注)
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 Less42 (POST type stack injection)
继承的注意事项
2022-07-31:给出一个有n个点,m条有向边的图, 你可以施展魔法,把有向边,变成无向边, 比如A到B的有向边,权重为7。施展魔法之后,A和B通过该边到达彼此的代价都是7。 求,允许施展一次魔法
一行代码解决CoreData托管对象属性变更在SwiftUI中无动画效果的问题
编译型语言和解释型语言的区别
Interview Blitz 69: Is TCP Reliable?Why?
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#
Thinking and Implementation of Object Cache Service
Mysql environment installation under Linux (centos)
date命令
When can I use PushGateway
The uniapp applet checks and prompts for updates
【读书笔记->数据分析】02 数据分析准备
网易云信圈组上线实时互动频道,「破冰」弱关系社交
Design of Fire and Anti-theft System Based on Single Chip GSM
周总结
标段参数说明
ICML2022 | 深入研究置换敏感的图神经网络