属性引用过多警告。可能的原因?

2023-11-22

我开发了一个应用程序,注意到我在 logcat 中收到很多“属性引用太多”警告。

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

我也使用 support.v7.23.1.0 设计库。我这样定义我的风格:

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

应用主题:

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

我搜索了问题,但我发现的是:

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

但我的应用程序中没有此类代码。

我想知道什么原因会导致这个警告?

更新2015-10-22 17:30我如何通过更改所有自定义样式来解决这个问题

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

我的意思是我让父母空着。不确定这是好还是坏解决方案?


我遇到了同样的问题,并且在某个时候创建​​了属性链。通过移除父级,链条就被打破了,所以你应该是好的。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

属性引用过多警告。可能的原因? 的相关文章

随机推荐

  • onTouch MotionEvent getTouchMinor 和 getTouchMajor 的数字结果总是完全相同,为什么?

    查看文档 触摸主坐标和触摸副坐标是触摸事件的椭圆轴 一种是触摸区域的最长测量长度 另一种是触摸事件的最短测量长度 就像椭圆的测量一样 不过 我在几台 Android 平板电脑上测试了 getTouchMajor 和 getTouchMino
  • Magento 中多个模块覆盖同一个核心文件

    Magento 如何处理覆盖同一核心文件的多个模块 是否可以 它是如何完成的 您有 3 种解决冲突的选择 将一个冲突文件中的代码合并到另一个文件中 并关闭其中一个文件中的重写 config xml 关闭一个 config xml 中的重写
  • C++ 中的函数组合

    有许多令人印象深刻的 Boost 库 例如 Boost Lambda 或 Boost Phoenix 它们在使 C 成为真正的函数式语言方面大有帮助 但是是否有一种直接的方法可以从任意 2 个或更多任意函数或函子创建复合函数 如果我有 in
  • strstr() 在 gcc 和 VS 中的实现是否具有线性复杂度?

    我知道有快速的字符串搜索算法 例如博耶 摩尔 and 高德纳 莫里斯 普拉特 其复杂度为 O n m 而普通解决方案为 O n m 那么 最流行的工具链 gcc 和 Visual Studio 的 strstr 实现是使用这些快速 O n
  • css 过渡不透明度在元素显示:无然后更改为显示:块的情况下不起作用

    正如标题所说 我有这个代码 https jsfiddle net fwo9ym1o javascript var container document querySelector container container style disp
  • 如何在 subprocess.Popen() 中使用现有环境变量

    Scenario 在我的 python 脚本中 我需要将一个可执行文件作为子进程运行 其中包含可执行文件所期望的 x 个命令行参数 Example EG 1 myexec sh 参数1 参数2 EG 2 myexec sh param1 M
  • 了解 Matlab FFT 示例

    我是 matlab 和 FFT 新手 想了解Matlab FFT 示例 现在我有两个主要问题 1 为什么x轴 频率 以500结束 我怎么知道没有更多频率或者它们只是被忽略了 2 我如何知道频率在0到500之间 FFT 不应该告诉我频率的限制
  • 如何检测 `snprintf` 错误?

    int snprintf char restrict s size t n const char restrict format snprintf 很好地防止超出目的地s 然而 当目的地不足以获得完整结果时 如何检测该错误和其他错误 以下内
  • 为什么在 Windows 上创建新进程比在 Linux 上更昂贵?

    我听说在 Windows 机器上创建新进程比在 Linux 上更昂贵 这是真的 有人可以解释为什么它更昂贵的技术原因 并提供这些原因背后的设计决策的任何历史原因吗 mweerden NT 从第一天起就是为多用户设计的 所以这并不是一个真正的
  • 在C++中连接字符串流

    如何连接两个字符串流 include
  • 长按按钮

    我想重复一个动作Button长时间按下 例如 MP3 阅读器的前进按钮 WinForm 中是否存在现有的 c 事件 我可以处理MouseDown启动一个计时器的事件 该计时器将执行该操作并停止MouseUp事件 但我正在寻找一种更简单的方法
  • 无法连接到远程://localhost:9999。连接超时 Jboss 7.1.1 Final

    我正在端口 9999 将构建部署到本地和远程 Jboss AS 7 1 1 Final Maven 使用 jboss 插件 jboss as maven plugin 7 1 1 Final 来管理服务器的构建 我已确认服务器已启动并正在运
  • Python:QML 布局内的 matplotlib 绘图

    考虑以下 python3 PyQt 代码来显示带有工具栏的交互式 matplotlib 图形 import sys sip import numpy as np from PyQt5 import QtGui QtWidgets from
  • 如何在 Rust 中按值传递装箱特征对象?

    我正在编写一些代码 并且有一个方法的特征 该方法需要self按价值 我想调用这个方法Box d 特征对象 消耗Box及其价值 这可能吗 如果是这样 怎么办 就代码而言 最小示例如下 不完整 代码 trait Consumable fn co
  • 保存后如何检索实体关系?

    我正在开发一个 RESTful 网络服务弹簧数据作为其数据访问层 由 JPA Hibernate 支持 领域实体之间存在关系是很常见的 例如 想象一个实体Product which has a Category entity 现在 当客户P
  • 从托管代码中释放非托管内存分配

    NET 应用程序调用 C dll C 代码为 char 数组分配内存并返回该数组作为结果 NET 应用程序以字符串形式获取此结果 C代码 extern C declspec dllexport char cdecl Run char res
  • 错误:找不到 com.android.support:support-v4:27.0.1

    将 Gradle 更新到 3 3 并将 Android Studio 版本更新到 3 0 1 后出现以下错误 Error 错误 找不到 com android support support v4 27 0 1 必需的 经过 项目 应用程序
  • 在 Python 中将日期时间列表转换为日期

    我有一个日期时间列表 想使用以下代码将其转换为日期 dates datetime strptime ts Y m d H M S for ts in timestamps date strings datetime strftime d m
  • 如何在 Ruby on Rails 中使用 if 语句为多个更改的字段创建回调?

    我想创建一个before save仅当三个字段 街道 城市 州 中的任何 但不一定是全部 发生更改时才会运行回调 你怎么做到这一点 谢谢 user rb class User before save run test method if g
  • 属性引用过多警告。可能的原因?

    我开发了一个应用程序 注意到我在 logcat 中收到很多 属性引用太多 警告 W ResourceType Too many attribute references stopped at 0x 我也使用 support v7 23 1