Javafx手风琴具有透明背景? [英] Javafx accordion with transparent background?

查看:140
本文介绍了Javafx手风琴具有透明背景?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

手风琴似乎与其他javafx元素的行为有所不同,因为我无法使用CSS使其背景透明。

Somehow accordion seems to behave differently than the other javafx elements, cause I cannot make its background transparent with CSS.

我在其中找到了一个提示:

I found a hint somewhere with this:

.accordion.titled-pane > *.content {
   -fx-background-color: null;
}

但这没用。也许语法不知道,我也尝试了不使用>和* ...

But it didn't work. Maybe the syntax, I don't know, I tried without the > and * too...

我的尝试与面板操作相同,所以:

My try was doing the same as with panels, so:

#leftTop{
    -fx-background-color: rgba(237, 243, 245, 0.8);
}

我设置了fx:id。它也不起作用。我使所有手风琴本身都位于手风琴上方的子节点也是如此,因此使用标题窗格和标题窗格上的锚定窗格。着色部分有其作用,但没有透明度。

I set the fx:id. It doesn't work either. I made this with all the child nodes the same too, that are "above" the accordion itself, so with the titled pane and the anchor pane that is on the titled pane. The colouring part has its effect but not the transparency.

我已经阅读到javafx有问题,但该评论来自2013年...

I have read that javafx had issues, but that comment was from 2013...

您知道解决方案吗?谢谢!

Do you know a solution? Thank you!

推荐答案

您只需要在 .accordion .titled-pane TitledPane Accordion ;没有空格,您将尝试匹配具有样式类手风琴和样式类):

You just need a space between .accordion and .titled-pane (the TitledPane is a child node of Accordion; without the space you are trying to match a single node that has both the style class accordion and the style class titled-pane):

.accordion .titled-pane > *.content{
    -fx-background-color: transparent ;
}

请注意,如果要使标题窗格的标题部分透明,则可以

Note that if you want the title portion of the titled pane transparent, you can do that with

.accordion .titled-pane .title {
    -fx-background-color: transparent ;
}

这篇关于Javafx手风琴具有透明背景?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆