1

如何在flex 4.6 spark DataGrid中设置alternatingRowColors alpah颜色

回答:

Tnx 到 www.Flextras.com 我找到了它:

在 DataGrid 皮肤中需要prepareGridVisualElement像这样覆盖:

public function prepareGridVisualElement(grid:Grid, rowIndex:int, columnIndex:int):void
{
    const dataGrid:DataGrid = grid.dataGrid;
    if (!dataGrid)
        return;

    const colors:Array = dataGrid.getStyle("alternatingRowColors");
    rowBackgroundFillColor.alpha = rowIndex % 2 == 0 ? 0 : 0.25;
}
4

1 回答 1

2

使用alternatingRowColors或样式。

引用文档:

用于初始化 DataGrid 的 rowBackground 皮肤部分。如果指定了alternatingRowColors 样式,则使用alternatingRowColorsBackground 皮肤部件作为rowBackground 皮肤部件的值。网格行的交替颜色由此样式的 Array 值中的连续条目定义。

如果要更改此样式的呈现方式,请替换 DataGridSkin 类中的 alternateRowColorsBackground 皮肤部分。如果要为每一行指定背景,则直接初始化 rowBackground 皮肤部分。默认值未定义。

于 2012-11-07T18:48:30.880 回答