简体   繁体   中英

Setting transparency of itemrenderers in spark list

I have a list that has alternating item colors.

<s:List id="myList" change="selectionChanged(event)" alternatingItemColors="[0x000000, 0xFFFFFF]" dataProvider="{alResults}" itemRenderer="itemRenders.Results" width="100%"></s:List>

I just simply want the item backgrounds to be transparent.

In the opening tag of the ItemRenderer, I tried this, but didn't work.

<s:ItemRenderer name="Results"
    xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    autoDrawBackground="true"
    contentBackgroundAlpha="0.2">

I tried setStyle in the data override method as well, and didn't work either. Thanks.

ItemRenderer : autoDrawBackground="false" will disable its background.
List : you can use contentBackgroundColor to change background color or contentBackgroundAlpha="0" to make it transparent.

One thing that comes to mind is to try adding transparency to the actual colors.

alternatingItemColors="[0x33000000, 0x33FFFFFF]"

If my math is right the 33 in hex would be around 0.2 alpha.

I've never done it in Flex but I've used it multiple times in Flash. Worth at least a try.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM