当前位置:网站首页>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);
边栏推荐
- cobaltstrike
- A high-quality WordPress download site template theme developed abroad
- Network security - crack WiFi through handshake packets (detailed tutorial)
- Advanced Algebra _ Proof _ Any matrix is similar to an upper triangular matrix
- UOS - WindTerm use
- IJCAI2022 | 代数和逻辑约束的混合概率推理
- SQL injection Less46 (injection after order by + rand() Boolean blind injection)
- /etc/resolv.conf的作用
- 景区手绘地图的绘制流程
- 【Acwing】第62场周赛 题解
猜你喜欢

Pytest first experience

Design of Fire and Anti-theft System Based on Single Chip GSM

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

Advanced Algebra _ Proof _ Any matrix is similar to an upper triangular matrix

What is customer profile management?

力扣二叉树

面试突击69:TCP 可靠吗?为什么?

How to reduce the gap between software design and implementation
Carefully organize 16 MySQL usage specifications to reduce problems by 80% and recommend sharing with the team

TFC CTF 2022 WEB Diamand WriteUp
随机推荐
mysql having的用法
Fixed-length usage of nanopb string type based on RT1052 Aworks (27)
One line of code to solve CoreData managed object properties change in SwiftUI problem of animation effects
Binary tree non-recursive traversal
如何导入 Golang 外部包并使用它?
Carefully organize 16 MySQL usage specifications to reduce problems by 80% and recommend sharing with the team
Mysql environment installation under Linux (centos)
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
"SDOI2016" Journey Problem Solution
【FPGA教程案例43】图像案例3——通过verilog实现图像sobel边缘提取,通过MATLAB进行辅助验证
SQL注入 Less38(堆叠注入)
TypeScript 的组件
面试突击69:TCP 可靠吗?为什么?
C# Rectangle基本用法和图片切割
hboot and recovery, boot.img, system.img
Interview Blitz 69: Is TCP Reliable?Why?
10大主流3D建模技术
@JsonFormat(pattern=“yyyy-MM-dd“)时间差问题
TFC CTF 2022 WEB Diamand WriteUp
什么是动态规划,什么是背包问题