创建向后兼容的 UI
使用收藏夹保持井然有序 根据您的偏好保存和分类内容。
本课程演示了如何在向后兼容的方式下使用 Android 较新版本中提供的 UI 组件和 API,确保您的应用程序仍然可以在之前版本的平台上运行。
在本课程中,Android 3.0 (API 级别 11) 中引入的新功能 Action Bar Tabs 将作为指导示例,但您可以将这些技术应用于其他 UI 组件和 API 功能。
课程
- 抽象新 API
- 确定您的应用程序需要哪些功能和 API。了解如何定义应用程序特定的、中间 Java 接口,这些接口将 UI 组件的实现抽象到您的应用程序。
- 代理到新 API
- 了解如何创建使用较新 API 的接口实现。
- 使用较旧的 API 创建实现
- 了解如何创建使用较旧 API 的接口自定义实现。
- 使用版本感知组件
- 了解如何在运行时选择要使用的实现,并在您的应用程序中开始使用该接口。
您还应该阅读
此页面上的内容和代码样本受内容许可中描述的许可条款约束。Java 和 OpenJDK 是 Oracle 和/或其关联公司的商标或注册商标。
上次更新时间:UTC 2024-02-22。
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-02-22 UTC."],[],[]]