Si verifica il seguente arresto anomalo sul Samsung Galaxy Ace/Y/Pocket/Mini. Funziona bene su tutti gli altri dispositivi. Arresti anomali si verificano solo su Android 2.3.5 o 2.3.6Samsung Galaxy/Holoeverywhere - Risorsa non è un ColorStateList (colore o percorso)
Non c'è alcun riferimento al mio codice nello stacktrace. Sembra provenire dal layout del menu che non ho personalizzato.
Sospetto che sia un errore nel sistema operativo Galaxy. Ma non posso confermare.
Ancora più importante, cosa posso evitare o attenuare questo errore?
android.view.InflateException: Binary XML file line #45: Error inflating class
at org.holoeverywhere.LayoutInflater._createView(SourceFile:382)
at org.holoeverywhere.LayoutInflater.onCreateView(SourceFile:594)
at org.holoeverywhere.LayoutInflater.createViewFromTag(SourceFile:444)
at org.holoeverywhere.LayoutInflater.rInflate(SourceFile:731)
at org.holoeverywhere.LayoutInflater.rInflate(SourceFile:734)
at org.holoeverywhere.LayoutInflater.inflate(SourceFile:538)
at org.holoeverywhere.LayoutInflater.inflate(SourceFile:488)
at com.android.internal.view.menu.MenuItemImpl.createItemView(MenuItemImpl.java:592)
at com.android.internal.view.menu.MenuItemImpl.getItemView(MenuItemImpl.java:577)
at com.android.internal.view.menu.MenuBuilder$MenuAdapter.getView(MenuBuilder.java:1173)
at android.widget.AbsListView.obtainView(AbsListView.java:1592)
at android.widget.ListView.measureHeightOfChildren(ListView.java:1251)
at android.widget.ListView.onMeasure(ListView.java:1162)
at android.view.View.measure(View.java:8313)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
at android.view.View.measure(View.java:8313)
at android.view.ViewRoot.performTraversals(ViewRoot.java:845)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1865)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3687)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
at org.holoeverywhere.LayoutInflater._createView(SourceFile:358)
... 26 more Caused by: android.content.res.Resources$NotFoundException: Resource is not a ColorStateList (color or path): TypedValue{t=0x1/d=0x7f0d014c a=3 r=0x7f0d014c}
at android.content.res.Resources.loadColorStateList(Resources.java:1804)
at android.content.res.TypedArray.getColorStateList(TypedArray.java:342)
at android.widget.TextView.(TextView.java:445)
at org.holoeverywhere.widget.TextView.(SourceFile:133)
at org.holoeverywhere.widget.TextView.(SourceFile:129)
... 29 more java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
at org.holoeverywhere.LayoutInflater._createView(SourceFile:358)
at org.holoeverywhere.LayoutInflater.onCreateView(SourceFile:594)
at org.holoeverywhere.LayoutInflater.createViewFromTag(SourceFile:444)
at org.holoeverywhere.LayoutInflater.rInflate(SourceFile:731)
at org.holoeverywhere.LayoutInflater.rInflate(SourceFile:734)
at org.holoeverywhere.LayoutInflater.inflate(SourceFile:538)
at org.holoeverywhere.LayoutInflater.inflate(SourceFile:488)
at com.android.internal.view.menu.MenuItemImpl.createItemView(MenuItemImpl.java:592)
at com.android.internal.view.menu.MenuItemImpl.getItemView(MenuItemImpl.java:577)
at com.android.internal.view.menu.MenuBuilder$MenuAdapter.getView(MenuBuilder.java:1173)
at android.widget.AbsListView.obtainView(AbsListView.java:1592)
at android.widget.ListView.measureHeightOfChildren(ListView.java:1251)
at android.widget.ListView.onMeasure(ListView.java:1162)
at android.view.View.measure(View.java:8313)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
at android.view.View.measure(View.java:8313)
at android.view.ViewRoot.performTraversals(ViewRoot.java:845)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1865)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3687)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
at dalvik.system.NativeStart.main(Native Method) Caused by: android.content.res.Resources$NotFoundException: Resource is not a ColorStateList (color or path): TypedValue{t=0x1/d=0x7f0d014c a=3 r=0x7f0d014c}
at android.content.res.Resources.loadColorStateList(Resources.java:1804)
at android.content.res.TypedArray.getColorStateList(TypedArray.java:342)
at android.widget.TextView.(TextView.java:445)
at org.holoeverywhere.widget.TextView.(SourceFile:133)
at org.holoeverywhere.widget.TextView.(SourceFile:129)
... 29 more android.content.res.Resources$NotFoundException: Resource is not a ColorStateList (color or path): TypedValue{t=0x1/d=0x7f0d014c a=3 r=0x7f0d014c}
at android.content.res.Resources.loadColorStateList(Resources.java:1804)
at android.content.res.TypedArray.getColorStateList(TypedArray.java:342)
at android.widget.TextView.(TextView.java:445)
at org.holoeverywhere.widget.TextView.(SourceFile:133)
at org.holoeverywhere.widget.TextView.(SourceFile:129)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
at org.holoeverywhere.LayoutInflater._createView(SourceFile:358)
at org.holoeverywhere.LayoutInflater.onCreateView(SourceFile:594)
at org.holoeverywhere.LayoutInflater.createViewFromTag(SourceFile:444)
at org.holoeverywhere.LayoutInflater.rInflate(SourceFile:731)
at org.holoeverywhere.LayoutInflater.rInflate(SourceFile:734)
at org.holoeverywhere.LayoutInflater.inflate(SourceFile:538)
at org.holoeverywhere.LayoutInflater.inflate(SourceFile:488)
at com.android.internal.view.menu.MenuItemImpl.createItemView(MenuItemImpl.java:592)
at com.android.internal.view.menu.MenuItemImpl.getItemView(MenuItemImpl.java:577)
at com.android.internal.view.menu.MenuBuilder$MenuAdapter.getView(MenuBuilder.java:1173)
at android.widget.AbsListView.obtainView(AbsListView.java:1592)
at android.widget.ListView.measureHeightOfChildren(ListView.java:1251)
at android.widget.ListView.onMeasure(ListView.java:1162)
at android.view.View.measure(View.java:8313)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
at android.view.View.measure(View.java:8313)
at android.view.ViewRoot.performTraversals(ViewRoot.java:845)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1865)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3687)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
at dalvik.system.NativeStart.main(Native Method)
Ecco l'intero theme.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CustomWindowTitleText" parent="TextAppearance.Sherlock.Widget.ActionBar.Title">
<item name="android:textColor">@color/primary_text_yellow</item>
<item name="android:textStyle">bold|italic</item>
</style>
<style name="CustomWindowTitleText.ActionBar">
<item name="android:textSize">@dimen/textsize_mid</item>
</style>
<style name="CustomWindowSubTitleText" parent="TextAppearance.Sherlock.Widget.ActionBar.Subtitle">
</style>
<!-- Changes the background color of the title bar -->
<style name="CustomWindowTitleBackground">
<item name="android:background">@drawable/background_window_title</item>
</style>
<!-- Set the theme for the window title -->
<!-- NOTE: setting android:textAppearance to style defined above -->
<style name="CustomWindowTitle">
<item name="android:singleLine">true</item>
<item name="android:shadowColor">#BB000000</item>
<item name="android:shadowRadius">2.75</item>
<item name="android:textAppearance">@style/CustomWindowTitleText</item>
<item name="android:paddingLeft">40dp</item>
</style>
<!--
http://actionbarsherlock.com/theming.html
Due to limitations in Android's theming system any theme customizations must be declared in two attributes.
The normal android-prefixed attributes apply the theme to the native action bar and the unprefixed attributes are for the custom implementation.
-->
<style name="CustomActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse"> <!--parent="@android:style/Widget.Holo.ActionBar"-->
<item name="android:background">@drawable/gradient_lightpurple_darkpurple_off</item> <!-- Use background that has color but not icon. -->
<item name="android:backgroundSplit">@drawable/gradient_lightpurple_darkpurple_off</item> <!-- Use background that has color but not icon. -->
<item name="android:titleTextStyle">@style/CustomWindowTitleText.ActionBar</item>
<item name="android:subtitleTextStyle">@style/CustomWindowSubTitleText</item>
<item name="background">@drawable/gradient_lightpurple_darkpurple_off</item> <!-- Use background that has color but not icon. -->
<item name="backgroundSplit">@drawable/gradient_lightpurple_darkpurple_off</item> <!-- Use background that has color but not icon. -->
<item name="titleTextStyle">@style/CustomWindowTitleText.ActionBar</item>
<item name="subtitleTextStyle">@style/CustomWindowSubTitleText</item>
</style>
<!-- Override properties in the default theme -->
<!-- NOTE: If you change the windowTitleTextSize you must explicitly the windowTitleSize property, the title bar will not re-size automatically, text will be clipped -->
<style name="JumbleeTheme" parent="Holo.Theme"> <!-- extends Theme.Sherlock -->
<item name="android:windowTitleStyle">@style/CustomWindowTitle</item>
<item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>
<item name="android:windowBackground">@drawable/gradient_off_darkpurple_off</item>
<item name="android:windowActionBar">true</item>
<item name="android:actionBarStyle">@style/CustomActionBar</item>
<item name="actionBarStyle">@style/CustomActionBar</item>
</style>
<style name="JumbleeTheme.GameScreen">
<item name="android:windowBackground">@color/black</item>
</style>
<!-- Facebook Theme -->
<style name="CustomWindowTitleText.ActionBar.Facebook">
<item name="android:textColor">@color/primary_text_white</item>
</style>
<!--
http://actionbarsherlock.com/theming.html
Due to limitations in Android's theming system any theme customizations must be declared in two attributes.
The normal android-prefixed attributes apply the theme to the native action bar and the unprefixed attributes are for the custom implementation.
-->
<style name="CustomActionBar.Facebook">
<item name="android:background">@drawable/background_window_title_facebook</item> <!-- Use background that has color but not icon. -->
<item name="android:backgroundSplit">@drawable/background_window_title_facebook</item> <!-- Use background that has color but not icon. -->
<item name="android:titleTextStyle">@style/CustomWindowTitleText.ActionBar.Facebook</item>
<item name="background">@drawable/background_window_title_facebook</item> <!-- Use background that has color but not icon. -->
<item name="backgroundSplit">@drawable/background_window_title_facebook</item> <!-- Use background that has color but not icon. -->
<item name="titleTextStyle">@style/CustomWindowTitleText.ActionBar.Facebook</item>
</style>
<!-- Facebook Sender Activity -->
<style name="FacebookSenderTheme" parent="Holo.Theme.Light">
<item name="android:actionBarStyle">@style/CustomActionBar.Facebook</item>
<item name="actionBarStyle">@style/CustomActionBar.Facebook</item>
</style>
</resources>
E la fonte per primary_text_yellow
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:color="@color/text_light_disabled" />
<item android:color="@color/app_yellow"/>
</selector>
sembra che il colore del testo predefinito sia impostato su qualcosa che è probabilmente un drawable o impostato su null o qualcosa del genere. Nel tema dell'attività, qual è il TextViewStyle e la definizione TextAppearance associata? –
Ciao Greg, ho aggiunto i dettagli sopra. L'unica volta che sovrascrivo TextAppearance è impostarlo su @ style/CustomWindowTitleText. – William