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:
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
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?
1 - Ok. I will correct and move the code from Sub Globals.
2 - Maybe here it is my mistake: I use the same drawable for many buttons which have different sizes, as you can see from the above code. Do you agree?