gpt4 book ai didi

Android:使用 API 级别 14 之前的 Switch Preference

转载 作者:IT老高 更新时间:2023-10-28 22:12:23 29 4
gpt4 key购买 nike

在 API 级别 14 之前,没有切换首选项。如果我使用preferences.xml 来创建我的偏好屏幕,有什么方法可以区分API 级别吗?那么有一个旧版本的复选框和一个 API 14 的开关?

最好的方法是什么?

最佳答案

If I use preferences.xml to create my preference screen is there some way to distinguish between the API levels? So having a check box for old releases and a switch for API 14?

创建一个 res/xml-v14/ 目录,其中包含一个 preferences.xml,其中包含您的 SwitchPreference。创建一个 res/xml/ 目录,其中包含一个 preferences.xml 文件,该文件将 SwitchPreference 替换为 CheckBoxPreference。 Android 将根据运行应用的设备版本加载正确的 preferences.xml 文件版本。

关于Android:使用 API 级别 14 之前的 Switch Preference,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9505901/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com