当前位置:网站首页>Live app source code, and the status bar and navigation bar are set to transparent status
Live app source code, and the status bar and navigation bar are set to transparent status
2022-06-11 12:04:00 【Yunbao network technology】
live broadcast app Source code , The status bar and navigation bar are set to the relevant code of transparent status implementation
Set page transparency , Use theme
register activity Set the theme
<style name="TranslucentNoActionBarTheme" parent="Theme.AppCompat.NoActionBar">
<item name="windowActionBar">false</item>
<item name="android:windowContentTransitions">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowIsTranslucent">true</item>
</style>
Set the status bar and navigation bar transparent
Directly call the following method , Transmit current activity that will do
public void setNavAndStatusBarTransparent(Activity activity) {
if (activity == null) {
return;
}
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window window = activity.getWindow(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (window != null) {
View decorView = window.getDecorView();
// Two flag It should be used in combination , Indicates that the main content of the application occupies the space of the system status bar
int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
decorView.setSystemUiVisibility(option);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
// The navigation bar color can also be set normally
window.setNavigationBarColor(Color.TRANSPARENT);
}
} else {
if (window != null) {
WindowManager.LayoutParams attributes = window.getAttributes(); if (attributes != null) {
int flagTranslucentStatus = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
int flagTranslucentNavigation = WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
attributes.flags |= flagTranslucentStatus;
attributes.flags |= flagTranslucentNavigation;
window.setAttributes(attributes);
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
Set up activity Click event transparent
Pay attention to onCreate Methodical setContenView Add the following code before
// Set up activity Click through transmission
WindowManager.LayoutParams layoutParams = getWindow().getAttributes();
layoutParams.flags = WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS |
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
That's all live broadcast app Source code , The status bar and navigation bar are set to the relevant code of transparent status implementation , More content welcome to follow the article
边栏推荐
- What is a Gerber file? Introduction to PCB Gerber file
- C# 将OFD转为PDF
- 让你搞懂冒泡排序(C语言)
- 采用快慢指针法来解决有关数组的问题(C语言)
- 軟件項目管理 7.1.項目進度基本概念
- Read geo expression matrix
- 解决swagger文档接口404的问题
- Pan domain SSL certificate, sectigo cheap wildcard certificate popularization plan
- Network protocol of yyds dry goods inventory: datagram socket for detailed explanation of socket protocol
- 广东市政安全施工资料管理软件2022新表格来啦
猜你喜欢

CVPR 2022 𞓜 text guided entity level image manipulation manitrans

Template engine - thymeleaf

2022 | framework for Android interview -- Analysis of the core principles of binder, handler, WMS and AMS!

Elk - elastalert largest pit

01_ Description object_ Class diagram

mysql 导入宝塔中数据库data为0000-00-00,enum为null出错

吊打面试官,涨姿势

Uncaught TypeError: Cannot set property ‘next‘ of undefined 报错解决

The role of Gerber file in PCB manufacturing
![[JUC supplementary] immutable object, shared meta mode, final principle](/img/c1/c29229108a3f66b83d13b4d90d49f7.jpg)
[JUC supplementary] immutable object, shared meta mode, final principle
随机推荐
[go] interpretation of gin source code
Hamiltonian graph
中国网络安全年会周鸿祎发言:360安全大脑构筑数据安全体系
2019 book list
吊打面试官,涨姿势
arguments. Callee implement function recursive call
It will be too late if you don't brush the questions. The most complete bat interview questions
typescript 编译选项和配置文件
Golang uses XOR ^ to exchange two variables and encrypt / decrypt them
yapi安装
导师转我800块,让我仿真一个电路(电源设计)
Where is it safer to open an account for soda ash futures? How is the deposit calculated?
WP super cache static cache plug-in concise tutorial
JS interview questions - arrow function, find and filter some and every
Android 11+ 配置SqlServer2014+
Network protocol of yyds dry goods inventory: datagram socket for detailed explanation of socket protocol
Let WordPress support registered users to upload custom avatars
Typescript compilation options and configuration files
C reads TXT file to generate word document
Node connects to MySQL database and writes fuzzy query interface