Blankj / Blankj/AndroidUtilCode

本库在android11上使状态栏亮色模式失效(不进行任何方法调用)

Đang mở
#1,658 0 bình luận 0 reaction 1 người được giao Được @Blankj nhận Xem trên GitHub
bug
Ngôn ngữ chính
Java
Star
33.6k
Fork
10.6k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

## Android11 引入此库后,会使android11的状态栏亮色模式仅生效一次

- AndroidUtilCode 的版本:1.31.0
- 出现 Bug 的设备型号:Pixel XL Api 3 (AndroidStudio Emulator)
- 设备的 Android 版本:api 30

### 使用AndroidStudio创建任意项目,build.gradle大致如下
```groovy
android {
compileSdk 32

defaultConfig {
applicationId "xxx"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
}
}

buildFeatures {
viewBinding = true
}

dependencies {

implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'androidx.activity:activity-ktx:1.4.0'
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.blankj:utilcodex:1.31.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
```

MainActivity相当简单,是一个空白页,onCreate内使用android11官方推荐的亮色模式
activity_main
```xml

```
```kotlin
class MainActivity : AppCompatActivity() {

private lateinit var binding: ActivityMainBinding

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
ViewCompat.getWindowInsetsController(window.decorView)?.isAppearanceLightStatusBars = true
}
}
```

启动后正常显示,符合预期,此时返回桌面,再次打开,状态栏就是暗色模式,没有使用任何UtilCode的代码。去掉此库后正常。
![GIF 2022-6-15 9-28-30](https://user-images.githubusercontent.com/22109299/173717166-2120e4be-0754-4fc5-8203-82f367a80fc1.gif)

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.