我最近在我的一个应用程序的Google Play生命周期部分注意到了一些兼容性警告。该问题似乎发生在某些活动的setContentView点,但是我不确定是什么原因导致的-看起来好像是活动Theme发生了什么,但是我不确定。该活动的主题如下,并在/ res / values / folder中定义。
<style name="Theme.MainActivity" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowBackground">@drawable/splash_screen</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowAnimationStyle">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">false</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
这是堆栈跟踪。
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z
at android.os.StrictMode.lambda$static$1(StrictMode.java:428)
at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
at java.lang.Class.getDeclaredMethodInternal(Native Method)
at java.lang.Class.getMethod(Class.java:2064)
at java.lang.Class.getDeclaredMethod(Class.java:2047)
at android.support.v7.widget.ViewUtils.<clinit>(ViewUtils.java:44)
at android.support.v7.widget.ViewUtils.makeOptionalFitsSystemWindows(Unknown Source:0)
at android.support.v7.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:685)
at android.support.v7.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:518)
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:466)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.test.MyActivity.b(MyActivity.java:1641)
at com.test.MyActivity.f(MyActivity.java:373)
at com.test.MyActivity.onCreate(MyActivity.java:345)
at android.app.Activity.performCreate(Activity.java:7144)
at android.app.Activity.performCreate(Activity.java:7135)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at ...