我想创建一个具有部分透明背景的视图(阶段、窗口)。我有个包含alpha通道的图像
我在javafx中使用了这种场景,我必须将场景填充设置为空,并将根节点背景色设置为透明。我也尝试过龙卷风:
class NextRoundView : View("KövetkezŠkör") {
override val root = vbox {
style {
backgroundColor = multi(Color.TRANSPARENT)
backgroundImage = multi(URI.create("/common/rope-bg-500x300.png"))
backgroundRepeat = multi(BackgroundRepeat.NO_REPEAT
to BackgroundRepeat.NO_REPEAT)
}
prefWidth = 500.0
prefHeight = 300.0
spacing = 20.0
padding = insets(50, 20)
text("A text") {
font = Font.font(40.0)
alignment = Pos.CENTER
}
button("OK")
{
font = Font.font(20.0)
action {
close()
}
}
sceneProperty().addListener{ _,_,n ->
n.fill = null
}
}
}
我这样称呼这个观点:
NextRoundView().apply {
openModal(stageStyle = StageStyle.TRANSPARENT, block = true)
}
然而,该阶段仍有背景:
我错过了什么?