apache-flex - 如何禁用列表中的选择和翻转颜色?

标签 apache-flex

如何禁用列表中的鼠标经过颜色,选择颜色和焦点颜色?我尝试将它们设置为“{null}”,但这只会使它们变黑:

<s:Application 
xmlns:fx="http://ns.adobe.com/mxml/2009" 
xmlns:s="library://ns.adobe.com/flex/spark"
width="100%" height="100%"
backgroundColor="white" 
>

<fx:Declarations>
    <s:ArrayCollection id="myArray">
        <fx:String>Item 0</fx:String>
        <fx:String>Item 1</fx:String>
        <fx:String>Item 2</fx:String>
        <fx:String>Item 3</fx:String>
        <fx:String>Item 4</fx:String>
    </s:ArrayCollection>
</fx:Declarations>

<s:VGroup horizontalAlign="center">

    <s:List dataProvider="{myArray}" width="200" height="200"
             focusColor="{null}" selectionColor="{null}"
             rollOverColor="{null}"
            >
        <s:itemRenderer>
            <fx:Component>
                <s:ItemRenderer>
                    <s:states>
                        <s:State name="normal"  />
                        <s:State name="hovered" />
                        <s:State name="selected" />
                    </s:states>



                    <s:Label text="{data}" width="100%" left="5" top="7" bottom="5" />
                </s:ItemRenderer>
            </fx:Component>
        </s:itemRenderer>
    </s:List>

</s:VGroup>
</s:Application>

最佳答案

尝试将itemRenderer中的autoDrawBackground属性设置为false。

<s:itemRenderer >
            <fx:Component>
                <s:ItemRenderer autoDrawBackground="false">
                    <s:states>
                        <s:State name="normal"  />
                        <s:State name="hovered" />
                        <s:State name="selected" />
                    </s:states>

                    <s:Label text="{data}" width="100%" left="5" top="7" bottom="5" />
                </s:ItemRenderer>
            </fx:Component>
        </s:itemRenderer>

关于apache-flex - 如何禁用列表中的选择和翻转颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5129968/

相关文章:

actionscript-3 - 如何将 bytearray 转换为图像或将图像转换为 bytearray ?

apache-flex - 从 4.1.0 升级到 Flex SDK 4.5.1 会导致某些 mx 组件出现命名空间编译错误

apache-flex - 使 spark ButtonBar 表现得像 mx ToggleButtonBar Flex 4

flash - 通过拖放上传文件

apache-flex - 将变量分配给 MXML 组件 ID

apache-flex - 弹性 4 : Title window goes out of accessible area

linux - Flex : MXML syntax highlighting, GNU/Linux 上的自动完成和括号匹配功能?

apache-flex - 没有 FlexBuilder 的 Flex 开发现实吗?

php - 如何访问ArrayCollection数据

apache-flex - 带有单个切片的饼图标签