当前位置:网站首页>Use code to set activity to transparent
Use code to set activity to transparent
2022-07-23 21:34:00 【-SOLO-】
private void translucentActivity(Activity activity) {
try {
activity.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
activity.getWindow().getDecorView().setBackground(null);
Method activityOptions = Activity.class.getDeclaredMethod("getActivityOptions");
activityOptions.setAccessible(true);
Object options = activityOptions.invoke(activity);
Class<?>[] classes = Activity.class.getDeclaredClasses();
Class<?> aClass = null;
for (Class clazz : classes) {
if (clazz.getSimpleName().contains("TranslucentConversionListener")) {
aClass = clazz;
}
}
Method method = Activity.class.getDeclaredMethod("convertToTranslucent",
aClass, ActivityOptions.class);
method.setAccessible(true);
method.invoke(activity, null, options);
} catch (Throwable t) {
t.printStackTrace();
}
}
边栏推荐
- Looking for the missing class name
- [attack and defense world web] difficulty four-star 12 point advanced question: flatscience
- Why cluster chat server introduces load balancer
- Pay more attention to which securities company has the lowest commission? Is it safe to open an account online?
- The third slam Technology Forum - Professor wuyihong
- MySQL数据库索引
- 比较关注证券公司究竟哪个佣金最低?请问网上开户安全么?
- Cluster chat server: cluster and distributed theory
- Kubevela offline installation
- TypeScript基础
猜你喜欢

Basic knowledge of mobile phone testing

TCP half connection queue and full connection queue (the most complete in History)

OpenCV图像处理——拉普拉斯金字塔

One of QT desktop whiteboard tools (to solve the problem of unsmooth curve -- Bezier curve)

Chapter 2 回归

Day109.尚医通:集成Nacos、医院列表、下拉列表查询、医院上线功能、医院详情查询

Cluster chat server: Framework Design of model data layer and encapsulation of database code

High numbers | calculation of triple integral 1 | high numbers | handwritten notes

Edge cloud | 1. overview

Vite3 learning records
随机推荐
Minimum spanning tree: prim
[complex overloaded operator]
Protocol buffers 的问题和滥用
Tell me the top ten securities companies? Is it safe to open an account online?
[continuous update] collection of raspberry pie startup and failure series
集群聊天服务器:chatService业务层
Flink principle and development summary (detailed)
221. Largest square ● &1277. Square submatrix with statistics all 1 ● ●
1309_ Add GPIO flip on STM32F103 and schedule test with FreeRTOS
[isprint function determines whether characters can be output]
Cluster chat server: network module chatServer
启牛是什么?请问一下手机开户股票开户安全吗?
【着色器实现RoundWave圆形波纹效果_Shader效果第六篇】
集群聊天服务器为什么引入负载均衡器
Kubevela offline installation
[attack and defense world web] difficulty four-star 12 point advanced question: flatscience
googletest
Uncertainty of distributed energy - wind speed test (realized by matlab code)
【arxiv】第一次上传论文小记
query中的customer exit客户出口变量