Recently encountered a problem, is originally a color icon, the result in the 5.x Device business status bar above notification icon color is black and white, and on the 4.x above is color.
Find this post on So, Http://stackoverflow.com/questions/28387602/notification-bar-icon-turns-white-in-android-5-lollipop. The main idea is that this is the new behavior of 5.x (API 21), if the android:targetsdkversion in Androidmanfifext.xml is set to 21, then on the 5.x system, this behavior. If you must display color, like 4.x, set Android:targetsdkversion to the old API number, for example 20.
This paper studies the mechanism of the next targetsdkversion effective. For this example, you can see the implementation code for Basestatusbar:
if (Entry.targetsdk >= build.version_codes. LOLLIPOP) { else { entry.icon.setColorFilter (null);}
He will determine whether to use black-and-white mode according to ENTRY.TARGETSDK.
The targetsdk here is in Android:targetsdkversion. If you look at the call relationship of this code, you will find that the value of ENTRY.TARGETSDK is through:
ApplicationInfo info = pmuser.getapplicationinfo (sbn.getpackagename (), 0= info.targetsdkversion;
Assignment, that is, the applicaitoninfo.targetsdkversion.
So if the app is running on a 5.x system (SDK version 21/22), if Targetsdkversion is specified as 21/22, then the black-and-white mode is applied, and if Targetsdkversion is specified as 20 or lower, This new primary color filter logic does not take effect, or the use of the original system behavior. So if we want to keep the application in the old system on the new system, it can be done by setting the property to the old API version.
If the targetsdkversion is set to 21 but runs on the old 4.x system (for example, API 19), it will not take effect because the actual SDK runtime does not handle this high-targetsdkversion code at all. And the SDK code is generally used >= a version number of the way to judge, so that write 21 and write 19 effect on 19 of the machine is exactly the same.
About Android:targetsdkversion