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

查看:42
本文介绍了具有透明背景的 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(TitledPaneAccordion 的子节点;如果没有空间,您将尝试匹配具有样式类 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天全站免登陆