0

是否存在会更改 Spark 列表中插入符号选择颜色的样式或属性?

注意:插入符号选择是使用键盘导航时行周围的边框颜色。它不是选定的行。

4

2 回答 2

2

好的,测试了一下,

<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" 
            xmlns:s="library://ns.adobe.com/flex/spark" 
            xmlns:mx="library://ns.adobe.com/flex/mx" 
            autoDrawBackground="true" height="60">
<fx:Script>
    <![CDATA[

        [Bindable] public var color1:uint = 0xE54545;
        [Bindable] public var color2:uint = 0xE5D145; 
        [Bindable] public var color3:uint = 0xA3E545;
        [Bindable] public var color4:uint = 0x45E5C6;
        [Bindable] public var color5:uint = 0x4564E5;
        [Bindable] public var color6:uint = 0xE545C6;


    ]]>
</fx:Script>


    <s:states>
        <s:State name="normal"/>            
        <s:State name="hovered"/>
        <s:State name="selected"/>
        <s:State name="normalAndShowsCaret"/>
        <s:State name="hoveredAndShowsCaret"/>
        <s:State name="selectedAndShowsCaret"/>
    </s:states>


    <s:Rect left="0" right="0" top="0" bottom="0">
        <s:stroke.normalAndShowsCaret>
            <s:SolidColorStroke 
                color="{color1}" 
                weight="1"/>
        </s:stroke.normalAndShowsCaret>
        <s:stroke.hoveredAndShowsCaret>
            <s:SolidColorStroke 
                color="{color2}" 
                weight="1"/>
        </s:stroke.hoveredAndShowsCaret>
        <s:stroke.selectedAndShowsCaret>
            <s:SolidColorStroke 
                color="{color3}" 
                weight="1"/>
        </s:stroke.selectedAndShowsCaret>
        <s:fill>
            <s:SolidColor 
                color.normal="{color1}"
                color.normalAndShowsCaret="{color2}" 
                color.hovered="{color3}"
                color.hoveredAndShowsCaret="{color4}"
                color.selected="{color5}"
                color.selectedAndShowsCaret="{color6}"
                />
        </s:fill>
    </s:Rect>

   <s:Label text="{data}"/> 
</s:ItemRenderer>

实际的插入符号颜色是第三笔划,“s:stroke.selectedAndShowsCaret”。为什么我的第一条评论不起作用是因为它默认也绑定到 color="{selectionColor}" ,所以您需要进行自定义 itemrender 或调整您当前的 itemrenderer 以匹配。

于 2013-07-23T06:19:29.370 回答
0

是的,它的属性“selectionColor”

list.setStyle("selectionColor", "#SOME_VALUE") or <s:List id="list" selectionColor="red"/>
于 2013-07-22T06:17:39.550 回答