加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-15 02:16:08 所属栏目:百科 来源:网络整理
导读:如何禁用翻转,选择将焦点聚焦在列表中?我尝试将它们设置为“{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:D
如何禁用翻转,选择&将焦点聚焦在列表中?我尝试将它们设置为“{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>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读