当前位置:网站首页>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);
边栏推荐
猜你喜欢

Flink 1.13(八)CDC

(26)Blender源码分析之顶层菜单的关于菜单

A high-quality WordPress download site template theme developed abroad

基于simulink的Passive anti-islanding-UVP/OVP and UFP/OFP被动反孤岛模型仿真

推荐系统:常用评价指标总结【准确率、精确率、召回率、命中率、(归一化折损累计增益)NDCG、平均倒数排名(MRR)、ROC曲线、AUC(ROC曲线下的面积)、P-R曲线、A/B测试】

How to reduce the gap between software design and implementation

高等代数_证明_任何矩阵都相似于一个上三角矩阵

什么是客户画像管理?

景区手绘地图的绘制流程
![[Cloud Residency Co-Creation] [HCSD Big Celebrity Live Broadcast] Personally teach the secrets of interviews in big factories](/img/7a/278ffada1cc660e7f5c2d7c66fa38e.png)
[Cloud Residency Co-Creation] [HCSD Big Celebrity Live Broadcast] Personally teach the secrets of interviews in big factories
随机推荐
Program processes and threads (concurrency and parallelism of threads) and basic creation and use of threads
MySQL数据库‘反斜杠\’ ,‘单引号‘’,‘双引号“’,‘null’无法存储
【读书笔记->数据分析】02 数据分析准备
Mysql environment installation under Linux (centos)
一文概述:VPN的基本模型及业务类型
[Reading Notes -> Data Analysis] 02 Data Analysis Preparation
《ArchSummit:时代的呐喊,技术人听得到》
编译型语言和解释型语言的区别
C# Rectangle basic usage and picture cutting
Keil nRF52832下载失败
[QNX Hypervisor 2.2用户手册]9.16 system
不知道该怎么办的同步问题
Interview assault 69: TCP reliable?Why is that?
SQL injection Less54 (limited number of SQL injection + union injection)
手写一个简单的web服务器(B/S架构)
lua入门案例实战123DIY
基于mysql的消息队列设计
hboot and recovery, boot.img, system.img
cobaltstrike
SVN服务器搭建+SVN客户端+TeamCity集成环境搭建+VS2019开发