B4J Question Transparent UI App

bdunkleysmith

Active Member
Licensed User
Longtime User
I have a UI application for which I would like to have a transparent background so that the UI labels, buttons, etc. would appear to float over the desktop background.

I have tried:
B4X:
MainForm.RootPane.Style = "-fx-background-color: rgba(0, 0, 0, 0);"
or
B4X:
MainForm.RootPane.Style = "-fx-background-color: transparent;"
but while the background has no color, it is not transparent and the desktop under the UI is hidden.

Thanks in anticipation of some suggestions, if in fact this is possible.
 

Cableguy

Expert
Licensed User
Longtime User
It is possible, as I use it in my B4j Launcher... (Splash animation has a transparent background)


Here My splash form initialize
B4X:
Public Sub Initialize
    SplashForm.Initialize("SplashForm", -1, -1) 'This makes it fullscreen
    SplashForm.SetFormStyle("TRANSPARENT") 'guess what this does
    SplashForm.RootPane.LoadLayout("SplashLayout") 'A silple 1 imageview layout in this case
    SplashForm.BackColor = fx.Colors.Transparent

    SplashForm.ShowAndWait
End Sub
 
Last edited:
Upvote 0

walterf25

Expert
Licensed User
Longtime User
It is possible, as I use it in my B4j Launcher... (Splash animation has a transparent background)


Here My splash form initialize
B4X:
Public Sub Initialize
    SplashForm.Initialize("SplashForm", -1, -1) 'This makes it fullscreen
    SplashForm.SetFormStyle("TRANSPARENT") 'guess what this does
    SplashForm.RootPane.LoadLayout("SplashLayout") 'A silple 1 imageview layout in this case
    SplashForm.BackColor = fx.Colors.Transparent

    SplashForm.ShowAndWait
End Sub
Hi Cable Guy, i just tried your code, i created a layout with an imageview, and load the layout on my form, i set it's properties to Transparent just like your code says but I can still see the gray color background on the form around the imageview, has things changed, is this still supported on the newest version of B4J?

Thanks,
Walter
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
I'm at my "day job" at the moment...
Are you creating a new form?
If so, have you hidden the main form?
Can you post your code?
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
I'm at my "day job" at the moment...
Are you creating a new form?
If so, have you hidden the main form?
Can you post your code?
Hi cableguy, actually it works now, but it's a bit weird, i had to set the color to Transparent in the Designer View, it seems that writing it in code is not enough.

Thanks,
Walter
 
Upvote 0
Top