如何在 FLEX 中更改 DropDownList 的背景颜色?
这就是我到目前为止所做的。
<!-- fill -->
<!--- Defines the appearance of drop-down list's background fill. -->
<s:Rect id="background" left="1" right="1" top="1" bottom="1" >
<s:fill>
<!---
The color of the drop down's background fill.
The default color is 0xFFFFFF.
-->
<s:SolidColor id="bgFill" color="#DB9E36"/>
</s:fill>
</s:Rect>
如果您仔细观察,您会发现我更改了 bgFill
颜色的默认值。但是,当我运行应用程序时,下拉列表的背景颜色仍然是默认的白色。
我在这里做错了什么吗?
提前致谢。
This is what I've done so far.
<!-- fill -->
<!--- Defines the appearance of drop-down list's background fill. -->
<s:Rect id="background" left="1" right="1" top="1" bottom="1" >
<s:fill>
<!---
The color of the drop down's background fill.
The default color is 0xFFFFFF.
-->
<s:SolidColor id="bgFill" color="#DB9E36"/>
</s:fill>
</s:Rect>
If you look closely you'll see that I've changed the default value for the bgFill
color. However, when I run my application, the background color for the dropdownlist is still the default white.
Am I doing anything wrong here?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简单的方法是使用ContentBackgroundColor样式。类似的东西:
更多细节..
创建自定义皮肤时;有一个称为ContentFill的属性列表;这样定义:
您会注意到这里列出的值是BGFILL;与您要更改的颜色相同的背景。可以通过使用contentItem属性公开检索它:
Sparkskin类(默认所有MXML皮肤均延伸)在UpdatedIsplaylist的内部访问此值。 ContentItems数组中的每个属性都使用ContentBackgroundColor具体特定的背景颜色,并且使用ContentBackgrandAlpha指定的Alpha。
在MXML中明确定义了一个值,然后[可能]在ActionScript中覆盖值有点误导。
Easy way to do this is by using the contentBackgroundColor style. Something like this:
Some more details..
When creating a custom skin; there is a list of properties called contentFill; defined like this:
You'll notice the value listed here is the bgFill; the same background whose color you are trying to change.. And it can be retrieved publicly by using the contentItem property:
The SparkSkin class [which all MXML Skins extend by default] access this value inside of updateDisplayList. Every property in the contentItems array has it's background color specificed using the contentBackgroundColor and it's alpha specified using contentBackgroundAlpha.
It is a bit misleading that a value is explicitly defined in the MXML then [potentially] overwritten in ActionScript.