B4J Question [SOLVED]TabPane label height

Sergey_New

Well-Known Member
Licensed User
Longtime User
Install the tab:
B4X:
Dim tp As TabPage
tp=TabPanel.LoadLayout("Tab1", "Persons"))
tp.Image = fx.LoadImageSample(File.DirAssets, "persons.png", 48, 48)

In this case, the drawing is not fully visible.
How do I change the height of the tab label?
 

mangojack

Expert
Licensed User
Longtime User
Try this ...

B4X:
Sub SetTabSize(tp As TabPane, width As Double, height As Double)
    Dim jo As JavaObject = tp
    jo.RunMethod("setTabMinWidth", Array(width))
    jo.RunMethod("setTabMaxWidth", Array(width))
    jo.RunMethod("setTabMinHeight", Array(height))
    jo.RunMethod("setTabMaxHeight", Array(height))
End Sub

Strangely.. running only setTabMinHeight changes the 1st Tab height only and likewise running only setTabMaxHeight only sets Tab2 height.
Running both , Sets both (All) tabs ?
 
Upvote 0

Sergey_New

Well-Known Member
Licensed User
Longtime User
mangojack, thanks!
I tried this for only one "minimum height" parameter and nothing worked.
As you said, "min-height" and "max-height" should be used together.
You don't need to change the width, because then it won't change depending on the length of the text.
This also works if the following code is specified in the CSS TabPane constructor:
B4X:
-fx-tab-min-height: 38;
-fx-tab-max-height: 38;
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…