Android 中的复古兼容性

Retro compatibility in Android

Android 如何处理复古兼容性?

例如。 我在我的清单中放了一个 min SDK 4.0。我的目标是 7.0,假设我使用 ConstraintLayout。然而 Android Studio 不会抛出任何错误。

问题:

Is it gonna show up well on a 4.0 device ?

它是支持库的一部分。它应该以相同的方式在任何地方显示,但你不能真正确定它在每个设备上看起来都很好。

How and why ?

如何:支持图书馆。为什么,供应商定制 android。有的重有的少。

Why do we sometimes see tests such as if (Build.VERSION.SDK_INT >= 9) ?

部分 api 可能尚未通过支持库向后移植。由于您正在针对最新版本进行编译,因此您将能够访问 api,这在旧版本的 android 中可能不存在。随着

(Build.VERSION.SDK_INT >= 9)

您正在检查设备上是否至少安装了 Gingerbread。由于您从 android 4 开始支持,因此您不需要该支票

How do app performing these tests usually deal with functionality they do not have access to (except throwing an error 'This function isn't available with your android version)

如果你指的是检查api级别,那么,如果一个人没有办法在不使用缺失方法的情况下重新实现相同的功能,那么他就不会提供该功能对于那个版本