How do Android deal with retro compatibility ?
I put a min SDK 4.0 in my manifest. My target is 7.0 and let's say I use ConstraintLayout. Yet Android Studio doesn't throw any error.
if (Build.VERSION.SDK_INT >= 9)
Is it gonna show up well on a 4.0 device ?
it is part of the support library. It is supposed to show everywhere in the same way, but you can't be really sure, that it will look good on each device.
How and why ?
how: support library. Why, vendors customize android. Some heavily some less.
Why do we sometimes see tests such as if (Build.VERSION.SDK_INT >= 9) ?
Part of the api may have not been backported, through the support library. Since you are compiling against the latest version, you will be able to access the api, that may not be present on older versions of android. With
(Build.VERSION.SDK_INT >= 9)
you are checking that on the device at least Gingerbread is installed. Since you are supporting from android 4 onward you don't need that check
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)
if you are referring to check the api level, then, if one doesn't have a way to re-implement the same functionality without using the missing methods, then he won't offer the functionality for that version