Blankj / Blankj/AndroidUtilCode

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

Abierto
#1,658 0 comentarios 0 reacciones 1 asignado Reclamado por @Blankj Ver en GitHub
bug
Lenguaje dominante
Java
Estrellas
33.6k
Forks
10.6k
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

## 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)

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.