B4J Question Tab Color

madru

Active Member
Licensed User
Longtime User
Hi,

I like to get some color to a Tab for easier identification.

I played with this:
B4X:
    Dim tp As TabPage = TabPane1.LoadLayout("tabLayout","Tab : "&tabCount)
    Dim mPane As Pane
    Private cvs AsCanvas
    Private iv AsImageView
    cvs.Initialize("")
    iv.Initialize("")
    mPane.Initialize("")
    mPane.AddNode(cvs, 0, 0, 1, 10)
    cvs.DrawCircle(2, 2, 20, fx.Colors.Red, True, 0)
    iv.Initialize("iv")
    mPane.AddNode(iv, 0, 0, 10, 10)
    iv.SetImage(mPane.Snapshot)
    Dim img As Image = iv.GetImage
    tp.Image=img

but I am wondering how to color the Tab (only) completely !


THX
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
SS-2017-05-23_16.32.13.png


B4X:
Sub SetTabPageColor(tp As TabPage, color As Paint)
   Dim jo As JavaObject = tp
   jo.RunMethod("setStyle", Array("-fx-background-color: " & CSSUtils.ColorToHex(color)))
End Sub

You can use a CSS file to change more properties: https://stackoverflow.com/questions/35017788/different-font-color-for-not-selected-tabs-tab-label
 
Upvote 0
Top