style.xml 中的自定义属性 [英] Custom attributes in styles.xml

查看:36
本文介绍了style.xml 中的自定义属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个自定义小部件,并在 layout.xml 中声明它.我还在 attr.xml 中添加了一些自定义属性.但是,当尝试在styles.xml 中的样式中声明这些属性时,它给了我找不到与给定名称匹配的资源:attr 'custom:attribute'.

I have created a custom widget, and I'm declaring it in layout.xml. I have also added some custom attributes in attr.xml. However, when trying to declare these attributes in a style in styles.xml, it's giving me No resource found that matches the given name: attr 'custom:attribute'.

我已将 xmlns:custom="http://schemas.android.com/apk/res/com.my.package" 放在 style.xml 的所有标签中,包括