'Level between 0 (transparent) to 1 (opaque)
Public Sub SetAlpha (View As B4XView, Level As Float)
#if B4A
Dim jo As JavaObject = View
Dim alpha As Float = Level
jo.RunMethod("setAlpha", Array(alpha))
#Else If B4J
Dim n As Node = View
n.Alpha = Level
#else if B4i
Dim v As View = View
v.Alpha = Level
#End If
End Sub
Public Sub SetShadow (View As B4XView, Offset As Double, Color As Int)
#if B4J
Dim DropShadow As JavaObject
'You might prefer to ignore panels as the shadow is different.
'If View Is Pane Then Return
DropShadow.InitializeNewInstance(IIf(View Is Pane, "javafx.scene.effect.InnerShadow", "javafx.scene.effect.DropShadow"), Null)
DropShadow.RunMethod("setOffsetX", Array(Offset))
DropShadow.RunMethod("setOffsetY", Array(Offset))
DropShadow.RunMethod("setRadius", Array(Offset))
Dim fx As JFX
DropShadow.RunMethod("setColor", Array(fx.Colors.From32Bit(Color)))
View.As(JavaObject).RunMethod("setEffect", Array(DropShadow))
#Else If B4A
Offset = Offset * 2
View.As(JavaObject).RunMethod("setElevation", Array(Offset.As(Float)))
#Else If B4i
View.As(View).SetShadow(Color, Offset, Offset, 0.5, False)
#End If
End Sub