Blankj / Blankj/AndroidUtilCode
获取Windowmanger对象报错,需要适配最新版本sdk
Open
@Blankj is already working on this.
Since Aug 30, 2022.
bug
- Dominant language
- Java
- Stars
- 33.6k
- Forks
- 10.6k
- PR merge metrics
- No merged PRs in 30d
Description
## 描述 Bug
简洁地描述下 Bug。
- AndroidUtilCode 的版本:1.31.1
- 设备的 Android 版本: Android 11
## 相关代码
Visual services, such as WindowManager, WallpaperService or LayoutInflater should be accessed from Activity or other visual Context. Use an Activity or a Context created with Context#createWindowContext(int, Bundle), which are adjusted to the configuration and visual bounds of an area on screen.
在工具类中任意地方获取windowmanager的都会报错, 比如 ScreenUtils.getScreenHeight()
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.