现在的位置: 首页 > 综合 > 正文

使用QuickReturnHeaderHelper 遇targetSdkVersion坑

2018年04月06日 ⁄ 综合 ⁄ 共 1624字 ⁄ 字号 评论关闭

添加第三方源码工程,第三方Demo在模拟器和真机都行。

java代码一模一样了,布局也一样,甚至新建工程添加第三方。

而自己测试出的效果仍是模拟器完美,真机效果不对。

找了半天的源码,最终确定是targetSdkVersion

targetSdkVersion=17,模拟器真机都OK。

targetSdkVersion=18,模拟器OK,真机不行。

android:targetSdkVersion
An integer designating the API Level that the application targets. If not set, the default value equals that given to minSdkVersion.

This attribute informs the system that you have tested against the target version and the system should not enable any compatibility behaviors to maintain your app's forward-compatibility with the target version.
The application is still able to run on older versions (down to minSdkVersion).

As Android evolves with each new version, some behaviors and even appearances might change. However, if the API level of the platform is higher than the version declared by your app'stargetSdkVersion,
the system may enable compatibility behaviors to ensure that your app continues to work the way you expect. You can disable such compatibility behaviors by specifyingtargetSdkVersion to
match the API level of the platform on which it's running. For example, setting this value to "11" or higher allows the system to apply a new default theme (Holo) to your app when running on Android 3.0 or higher and also disables screen
compatibility mode
 when running on larger screens (because support for API level 11 implicitly supports larger screens).

There are many compatibility behaviors that the system may enable based on the value you set for this attribute. Several of these behaviors are described by the corresponding platform versions in theBuild.VERSION_CODES reference.

To maintain your application along with each Android release, you should increase the value of this attribute to match the latest API level, then thoroughly test your application on the corresponding platform version.

参考

http://blog.csdn.net/a2bgeek/article/details/8203583

【上篇】
【下篇】

抱歉!评论已关闭.