2015-10-22 6 views
7

Ich entwickelte eine Anwendung und bemerkte, dass ich eine Menge von "Zu viele Attributreferenzen" Warnungen in logcat bekommen.Zu viele Attributverweiswarnungen. Mögliche Ursachen?

W/ResourceType﹕ Too many attribute references, stopped at: 0x######## 

Ich benutze support.v7.23.1.0 auch Design-Bibliothek. Ich definiere meine Stile wie folgt aus:

<style name="AppTheme.Description.TextView" parent="@android:style/Widget.TextView"> 
     <item name="android:textColor">@color/textColorSecondary</item> 
     <item name="android:textColorPrimary">@color/textColorSecondary</item> 
     <item name="android:textSize">@dimen/textSizeItemDescription</item> 
    </style> 

Anwendung Thema:

<!-- Base application theme. --> 
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> 
    <!-- Customize your theme here. --> 
    <item name="android:textColorHighlight">@color/colorPrimaryLight</item> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <!--status bar background color--> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <!-- color of drawer toggle and other stuff--> 
    <item name="android:textColorSecondary">@color/textColorSecondary</item> 
    <!-- Used to define what color preference categories titles will be--> 
    <item name="colorAccent">@color/colorAccent</item> 
    <!--overrides text color secondary for widgets and action mode  --> 
    <item name="colorControlNormal">@color/colorControlNormal</item> 
    <!--when widget is activated for text writing or stuff --> 
    <item name="colorControlActivated">@color/colorPrimaryLight</item> 
    <!--when menu items are being Clicked --> 
    <item name="colorControlHighlight">@color/colorPrimaryLight</item> 
    <!--used in all areas where text color is needed (TextViews, Spinners, etc)--> 
    <item name="android:textColor">@color/textColor</item> 
    <!--used in text inputs like EditText--> 
    <item name="android:textColorPrimary">@color/textColorPrimary</item> 
    <!--main application background--> 
    <item name="android:colorBackground">@color/colorBackground</item> 
    <item name="drawerArrowStyle">@style/Theme.DrawerArrowStyle</item> 
    <!--Context action meniu will overlay toolbar--> 
    <item name="windowActionModeOverlay">true</item> 
    <item name="toolbarStyle">@style/AppTheme.Toolbar</item> 

</style> 

ich das Problem gesucht, aber alles, was ich gefunden:

TextView txtView= new TextView(new ContextThemeWrapper(context, R.style.styleName)); 

Aber ich habe nicht diese Art Code in meiner App.

Ich möchte wissen, welche Gründe diese Warnung verursachen können?

-Update 2015-10-22 17:30 ich einige, wie dieses Problem gelöst, indem sie alle Arten individuelle Ändern ähnliche

<style name="AppTheme.Description.TextView" parent=""> 
     <item name="android:textColor">@color/textColorSecondary</item> 
     <item name="android:textColorPrimary">@color/textColorSecondary</item> 
     <item name="android:textSize">@dimen/textSizeItemDescription</item> 
    </style> 

I i Eltern leer gelassen bedeuten. Nicht sicher, ob das eine gute oder schlechte Lösung ist?

Antwort

7

Ich hatte das gleiche Problem und irgendwann wurde eine Attributkette erstellt. Durch das Entfernen des Elternteils wird die Kette gebrochen, also solltest du gut sein.

+1

genau was ich tatsächlich tat. – Alpha

+0

genau das, was ich gesucht habe. Vielen Dank –

Verwandte Themen