Lun*_*lpo 4 android android-preferences androidx
我开始新的电视应用程序,现在我需要为流的设置质量、流的语言等开发动态首选项。所以我计划使用 android.preference 库并根据流数据动态生成性能。但是在https://developer.android.com/guide/topics/ui/settings.html 上是
注意:本指南介绍了如何使用 AndroidX 首选项库。从 Android 10 开始,平台 android.preference 库已弃用。
但是没有重定向到替换。那么用什么来代替 android.preference 库呢?
在该指南上还请注意:
注意:本指南假设您使用的是 androidx.preference:preference :1.1.0-alpha04 或更高版本。某些功能在旧版本的库上可能不可用。
所以androidx.preference:preference会被弃用。
不推荐使用平台 android.preference 库。但是没有重定向到替换。
您可以查看Android 10 文档:自Android 10 起,
不推荐使用 android.preference 库。开发人员应该改用 AndroidX 首选项库,它是 Android Jetpack 的一部分。
替代品是androidx-preference库。
只需使用:
dependencies {
def preference_version = "1.1.0"
// Java
implementation "androidx.preference:preference:$preference_version"
// Kotlin
implementation "androidx.preference:preference-ktx:$preference_version"
}
Run Code Online (Sandbox Code Playgroud)
有关发行说明的更多信息。
还:
注意:本指南假设您使用的是 androidx.preference:preference:1.1.0-alpha04 或更高版本。某些功能在旧版本的库上可能不可用。
这意味着当发布处于 alpha 状态时,可能会添加、删除或更改 API。
| 归档时间: |
|
| 查看次数: |
1702 次 |
| 最近记录: |