Too many attribute references warning. Possible causes?

天大地大妈咪最大 提交于 2019-12-06 23:21:29

问题


I developed an aplication and noticed that i get a lot of " Too many attribute references" warnings in logcat.

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

I use support.v7.23.1.0 also design library. I define my styles like this:

 <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>

Application theme:

<!-- 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>

I searched the problem , but all i found is :

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

But I don't have that kind of code in my app.

I wish to know what reasons can cause this warning?

Update 2015-10-22 17:30 I some how resolved this problem by changing all custom styles like this

<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 mean i left parent empty. Not sure if this is good solution or bad ?


回答1:


I had the same issue and at some point an attribute chain was created. By removing the parent the chain is broken so you should be good.



来源:https://stackoverflow.com/questions/33283105/too-many-attribute-references-warning-possible-causes

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!