JavaFX - How to remove ListView & TableView's bands?

katana :

I'm adding JavaFX ListViews & TableViews to my app in their default style.

The odd rows got a white background and even rows got a grey background. I don't like those bands, especially on unpopulated rows.

I tried the following CSS settings on my ListView with fxid:list_PayMethod but doesn't help.

(this page doesn't recognize the fxid as part of the code, so it is not inside the grey box, please note.)

#list_PayMethod {

    .list-cell:odd {
        -fx-padding: 0px;
        -fx-control-background: #F4F4F4;
        -fx-control-inner-background: #F4F4F4;
    }

    .list-cell:even {
        -fx-padding: 0px;
        -fx-control-background: #F4F4F4;
        -fx-control-inner-background: #F4F4F4;
    }

    .list-view:focused .list-cell:focused:odd {
        -fx-padding: 0px;
        -fx-control-background: #F4F4F4;
        -fx-control-inner-background: #F4F4F4;
    }

    .list-view:focused .list-cell:focused:even {
        -fx-padding: 0px;
        -fx-control-background: #F4F4F4;
        -fx-control-inner-background: #F4F4F4;
    }
}

Is there any way to set all to write or all grey?

Thanks!

M. S. :

Replace -fx-control-background with -fx-background-color and that should be enough.

.list-cell {
    -fx-background-color: #F4F4F4;
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=359277&siteId=1