Questions tagged «declare-styleable»

2
在Android中声明可样式化的属性
关于declare-styleable标签的宝贵文档很少,我们可以通过这些标签声明组件的自定义样式。我确实找到了标签属性的有效值列表。尽管这很好,但并没有说明如何使用其中一些值。浏览attr.xml(标准属性的Android源)时,我发现您可以执行以下操作:formatattr <!-- The most prominent text color. --> <attr name="textColorPrimary" format="reference|color" /> 的 format属性显然可以设置为值的组合。大概该format属性可以帮助解析器解释实际的样式值。然后我在attr.xml中发现了这一点: <!-- Default text typeface. --> <attr name="typeface"> <enum name="normal" value="0" /> <enum name="sans" value="1" /> <enum name="serif" value="2" /> <enum name="monospace" value="3" /> </attr> <!-- Default text typeface style. --> <attr name="textStyle"> <flag name="normal" value="0" /> …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.