Hello to everybody, I hope on someone's help for the following issue cause I'm not able to find a way to fix it.
I have some panels and some buttons of different sizes on each of them. Buttons are set as GradientDrawable, set colors and sizes in designer. Everything worked fine until I wanted to assign buttons' colors at runtime. So I use:
Then I call a sub to assign colors and text size:
The strange effect I have is shown in the attached screenshots. I show the panel in pic1 then, without closing it, I show another panel (pic2), then if I show again the first panel all buttons on it changed their sizes (pic3) taking the sizes of buttons on panel in pic2. What do I do wrong?
I have some panels and some buttons of different sizes on each of them. Buttons are set as GradientDrawable, set colors and sizes in designer. Everything worked fine until I wanted to assign buttons' colors at runtime. So I use:
B4X:
Sub Globals
Dim ColGreen(2),ColRed(2), ColBlu(2) As Int
Dim sGreen,sRed, sBlu As GradientDrawable
ColRed(0) = Colors.LightGray
ColRed(1) = Colors.red
ColGreen(0)= Colors.LightGray
ColGreen(1)= Colors.RGB (9, 108, 1)
ColBlu(0) = Colors.LightGray
ColBlu(1) = Colors.Blue
sGreen.Initialize("TOP_BOTTOM", ColGreen)
sGreen.CornerRadius = 6
sRed.Initialize("TOP_BOTTOM", ColRed)
sRed.CornerRadius =6
sBlu.Initialize("TOP_BOTTOM", ColBlu)
sBlu.CornerRadius =6
End sub
Then I call a sub to assign colors and text size:
B4X:
Button1.Background=sGreen
Button2.Background=sGreen
Button3.Background=sGreen
Button4.Background=sGreen
Button1.TextSize =18
Button2.TextSize =18
Button3.TextSize =18
Button4.TextSize =18
......................................
The strange effect I have is shown in the attached screenshots. I show the panel in pic1 then, without closing it, I show another panel (pic2), then if I show again the first panel all buttons on it changed their sizes (pic3) taking the sizes of buttons on panel in pic2. What do I do wrong?