AppCompact导致ArrayIndexOutOfBounds异常,在方法setContentView期间,我尝试了各种解决方案,我可以在这里搜索,但它没有帮助。它包括继承自Theme.AppCompat.Light.NoActionBar
此外,当我从FragmentActivity扩展我的活动时,它正常工作
堆栈跟踪是:
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=1926; index=-91619004
at android.content.res.TypedArray.hasValue(TypedArray.java)
at android.support.v7.app.AppCompatDelegateImplV7.createSubDecor(AppCompatDelegateImplV7.java:341)
at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:312)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:277)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.itp.android.retailer.epayment.splashscreen.ActivitySplashScreen.onCreate(ActivitySplashScreen.java:31)
at android.app.Activity.performCreate(Activity.java)
创建活动:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.activity_splash_screen);
...
}
值/ style.xml
<!-- for when ExtendedActivity extends from v7 ApPCompactActivity -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowAnimationStyle">@null</item>
<item name="android:windowEnterAnimation">@null</item>
<item name="android:windowExitAnimation">@null</item>
</style>
<style name="AppThemeDialog" parent="android:Theme.Holo.Light.Dialog.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:background">@null</item>
<item name="android:windowBackground">@null</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:backgroundDimAmount">0.5</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowFrame">@null</item>
<item name="android:windowTitleStyle">@null</item>
</style>
gradle,以防万一
android {
compileSdkVersion 24
buildToolsVersion '25.0.0'
defaultConfig {
minSdkVersion 16
targetSdkVersion 23
multiDexEnabled true
}
}