删除列表项底部的边框

发布于 2024-11-25 18:26:09 字数 767 浏览 3 评论 0原文

在此处输入图像描述

红色突出显示部分!我该如何删除它?渲染列表的代码如下:

<s:List id="ui_lstIndexList" width="175" height="600" fontFamily="TwinCen"
                fontSize="24"
                alternatingItemColors="[]" borderVisible="false" downColor="#7fceff"
                change="showAlert(event)" contentBackgroundColor="#6fa8bc" color="#FFFFFF"
                dataProvider="{indexArrayCollection}" selectionColor="#7fceff">
            <s:itemRenderer>
                <fx:Component>
                    <s:IconItemRenderer labelField="name" messageField="artist"/>
                </fx:Component>
            </s:itemRenderer>
        </s:List>

谢谢!!!

enter image description here

Highlighted portion in red! How do i remove it? Code to render list is below:

<s:List id="ui_lstIndexList" width="175" height="600" fontFamily="TwinCen"
                fontSize="24"
                alternatingItemColors="[]" borderVisible="false" downColor="#7fceff"
                change="showAlert(event)" contentBackgroundColor="#6fa8bc" color="#FFFFFF"
                dataProvider="{indexArrayCollection}" selectionColor="#7fceff">
            <s:itemRenderer>
                <fx:Component>
                    <s:IconItemRenderer labelField="name" messageField="artist"/>
                </fx:Component>
            </s:itemRenderer>
        </s:List>

Thanks!!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

猛虎独行 2024-12-02 18:26:09

这不是一件“容易”的事情。您需要创建一个扩展 IconItemRenderer 的自定义类,并从那里重写受保护的函数drawBackground(unscaledWidth:Number, unscaledHeight:Number):void。您需要删除在函数末尾绘制分隔符的部分。我知道,这是愚蠢的,他们应该有一个样式,但你总是可以实现你自己的:

protected function drawBackground(unscaledWidth:Number, 
                                  unscaledHeight:Number):void
{
    // figure out backgroundColor
    var backgroundColor:*;
    var downColor:* = getStyle("downColor");
    var drawBackground:Boolean = true;

    if (down && downColor !== undefined)
    {
        backgroundColor = downColor;
    }
    else if (selected)
    {
        backgroundColor = getStyle("selectionColor");
    }
    else if (hovered)
    {
        backgroundColor = getStyle("rollOverColor");
    }
    else if (showsCaret)
    {
        backgroundColor = getStyle("selectionColor");
    }
    else
    {
        var alternatingColors:Array;
        var alternatingColorsStyle:Object = getStyle("alternatingItemColors");

        if (alternatingColorsStyle)
            alternatingColors = (alternatingColorsStyle is Array) ? (alternatingColorsStyle as Array) : [alternatingColorsStyle];

        if (alternatingColors && alternatingColors.length > 0)
        {
            // translate these colors into uints
            styleManager.getColorNames(alternatingColors);

            backgroundColor = alternatingColors[itemIndex % alternatingColors.length];
        }
        else
        {
            // don't draw background if it is the contentBackgroundColor. The
            // list skin handles the background drawing for us. 
            drawBackground = false;
        }

    } 

    // draw backgroundColor
    // the reason why we draw it in the case of drawBackground == 0 is for
    // mouse hit testing purposes
    graphics.beginFill(backgroundColor, drawBackground ? 1 : 0);
    graphics.lineStyle();
    graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
    graphics.endFill();

    var topSeparatorColor:uint;
    var topSeparatorAlpha:Number;
    var bottomSeparatorColor:uint;
    var bottomSeparatorAlpha:Number;

    // Selected and down states have a gradient overlay as well
    // as different separators colors/alphas
    if (selected || down)
    {
        var colors:Array = [0x000000, 0x000000 ];
        var alphas:Array = [.2, .1];
        var ratios:Array = [0, 255];
        var matrix:Matrix = new Matrix();

        // gradient overlay
        matrix.createGradientBox(unscaledWidth, unscaledHeight, Math.PI / 2, 0, 0 );
        graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
        graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
        graphics.endFill();
    }

    // separators are a highlight on the top and shadow on the bottom
    /* OLD WAY OF DOING IT
    topSeparatorColor = 0xFFFFFF;
    topSeparatorAlpha = .3;
    bottomSeparatorColor = 0x000000;
    bottomSeparatorAlpha = .3;
    */

    // NEW WAY
    topSeparatorColor = getStyle('topSeparatorColor');
    topSeparatorAlpha = getStyle('topSeparatorAlpha');
    bottomSeparatorColor = getStyle('bottomSeparatorColor');
    bottomSeparatorAlpha = getStyle('bottomSeparatorAlpha');


    // draw separators
    // don't draw top separator for down and selected states
    if (!(selected || down))
    {
        graphics.beginFill(topSeparatorColor, topSeparatorAlpha);
        graphics.drawRect(0, 0, unscaledWidth, 1);
        graphics.endFill();
    }

    graphics.beginFill(bottomSeparatorColor, bottomSeparatorAlpha);
    graphics.drawRect(0, unscaledHeight - (isLastItem ? 0 : 1), unscaledWidth, 1);
    graphics.endFill();


    // add extra separators to the first and last items so that 
    // the list looks correct during the scrolling bounce/pull effect
    // top
    if (itemIndex == 0)
    {
        graphics.beginFill(bottomSeparatorColor, bottomSeparatorAlpha);
        graphics.drawRect(0, -1, unscaledWidth, 1);
        graphics.endFill(); 
    }

    // bottom
    if (isLastItem)
    {
        // we want to offset the bottom by 1 so that we don't get
        // a double line at the bottom of the list if there's a 
        // border
        graphics.beginFill(topSeparatorColor, topSeparatorAlpha);
        graphics.drawRect(0, unscaledHeight + 1, unscaledWidth, 1);
        graphics.endFill(); 
    }


}

从这里,你只需要设置 topSeparatorColor、Alpha 或其他样式。或者甚至改变这一切并使用“showSeparator”样式将它们全部隐藏起来。你可以用它做任何你想做的事。

Not an "easy" thing to do. You need to create a custom class that extends IconItemRenderer and from there you need to override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void. You'll need to remove the part where it draws the separator at the end of the function. I know, it's idiotic, they should of had a style for that, but you could always implement your own:

protected function drawBackground(unscaledWidth:Number, 
                                  unscaledHeight:Number):void
{
    // figure out backgroundColor
    var backgroundColor:*;
    var downColor:* = getStyle("downColor");
    var drawBackground:Boolean = true;

    if (down && downColor !== undefined)
    {
        backgroundColor = downColor;
    }
    else if (selected)
    {
        backgroundColor = getStyle("selectionColor");
    }
    else if (hovered)
    {
        backgroundColor = getStyle("rollOverColor");
    }
    else if (showsCaret)
    {
        backgroundColor = getStyle("selectionColor");
    }
    else
    {
        var alternatingColors:Array;
        var alternatingColorsStyle:Object = getStyle("alternatingItemColors");

        if (alternatingColorsStyle)
            alternatingColors = (alternatingColorsStyle is Array) ? (alternatingColorsStyle as Array) : [alternatingColorsStyle];

        if (alternatingColors && alternatingColors.length > 0)
        {
            // translate these colors into uints
            styleManager.getColorNames(alternatingColors);

            backgroundColor = alternatingColors[itemIndex % alternatingColors.length];
        }
        else
        {
            // don't draw background if it is the contentBackgroundColor. The
            // list skin handles the background drawing for us. 
            drawBackground = false;
        }

    } 

    // draw backgroundColor
    // the reason why we draw it in the case of drawBackground == 0 is for
    // mouse hit testing purposes
    graphics.beginFill(backgroundColor, drawBackground ? 1 : 0);
    graphics.lineStyle();
    graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
    graphics.endFill();

    var topSeparatorColor:uint;
    var topSeparatorAlpha:Number;
    var bottomSeparatorColor:uint;
    var bottomSeparatorAlpha:Number;

    // Selected and down states have a gradient overlay as well
    // as different separators colors/alphas
    if (selected || down)
    {
        var colors:Array = [0x000000, 0x000000 ];
        var alphas:Array = [.2, .1];
        var ratios:Array = [0, 255];
        var matrix:Matrix = new Matrix();

        // gradient overlay
        matrix.createGradientBox(unscaledWidth, unscaledHeight, Math.PI / 2, 0, 0 );
        graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
        graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
        graphics.endFill();
    }

    // separators are a highlight on the top and shadow on the bottom
    /* OLD WAY OF DOING IT
    topSeparatorColor = 0xFFFFFF;
    topSeparatorAlpha = .3;
    bottomSeparatorColor = 0x000000;
    bottomSeparatorAlpha = .3;
    */

    // NEW WAY
    topSeparatorColor = getStyle('topSeparatorColor');
    topSeparatorAlpha = getStyle('topSeparatorAlpha');
    bottomSeparatorColor = getStyle('bottomSeparatorColor');
    bottomSeparatorAlpha = getStyle('bottomSeparatorAlpha');


    // draw separators
    // don't draw top separator for down and selected states
    if (!(selected || down))
    {
        graphics.beginFill(topSeparatorColor, topSeparatorAlpha);
        graphics.drawRect(0, 0, unscaledWidth, 1);
        graphics.endFill();
    }

    graphics.beginFill(bottomSeparatorColor, bottomSeparatorAlpha);
    graphics.drawRect(0, unscaledHeight - (isLastItem ? 0 : 1), unscaledWidth, 1);
    graphics.endFill();


    // add extra separators to the first and last items so that 
    // the list looks correct during the scrolling bounce/pull effect
    // top
    if (itemIndex == 0)
    {
        graphics.beginFill(bottomSeparatorColor, bottomSeparatorAlpha);
        graphics.drawRect(0, -1, unscaledWidth, 1);
        graphics.endFill(); 
    }

    // bottom
    if (isLastItem)
    {
        // we want to offset the bottom by 1 so that we don't get
        // a double line at the bottom of the list if there's a 
        // border
        graphics.beginFill(topSeparatorColor, topSeparatorAlpha);
        graphics.drawRect(0, unscaledHeight + 1, unscaledWidth, 1);
        graphics.endFill(); 
    }


}

And from here, you just need to set the topSeparatorColor,Alpha, or other styles. Or even change all that and have a 'showSeparator' style which just hides them all altogether. You can do whatever you want with it.

小矜持 2024-12-02 18:26:09

单击您的 IconItemRenderer,然后开始输入“skinClass”。当您使用代码完成时,它将提供“新皮肤...”选项,使用它来创建新的可编辑皮肤。如果不存在,它将在列表皮肤中。

Click your IconItemRenderer, and start typing "skinClass." When you use the code completion, it will offer the option of "new skin..." Use that to create a new, editable skin. If it is not there, it will be in the List skin.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文