Android Question Colordrawable panels change shape when clicked

DickD

Active Member
Licensed User
I have created many layouts in code successfully. However, I recently tried to add color backgrounds and borders to some panels for the first time using Colordrawables. In the code shown below when I click on any of the EditText fields the panel border suddenly gets smaller in height from about the 200dip it starts out as to about 140 dip. The bottom edge of the panel overlays the Agelbl line. Also, if I pause and then resume the app the same thing happens. Why?

B4X:
Dim ScrollView1 As ScrollView
Dim cd, cd2 As ColorDrawable
cd.Initialize2(Colors.Blue,30,20,0xFFADFF2F)
cd2.Initialize(Colors.Blue,5)
ScrollView1.Initialize(1000dip)
Activity.AddView(ScrollView1, 0dip, 0dip, 400dip,720dip)

'******** Top Panel ************
Dim topPanel As Panel
topPanel.Initialize(300dip)
topPanel.Background = cd
ScrollView1.Panel.AddView(topPanel,5dip,0dip,350dip,200dip)
Namelbl.Initialize("")
Namelbl.Text = "Screen Name: "
Namelbl.TextColor = Colors.White
Namelbl.TextSize = 20
PNlbl.Initialize("")
PNlbl.Text = "Phone Number:"
PNlbl.Textcolor= Colors.White
PNlbl.TextSize = 20
Agelbl.Initialize("")
Agelbl.Text = "Age:"
Agelbl.TextSize = 20
Agelbl.TextColor = Colors.white
ScreenName.Initialize("")
PhoneNumber.Initialize("")
YOB.Initialize("")
topPanel.AddView(Namelbl,10dip,10dip, 130dip,50dip)
topPanel.AddView(ScreenName,150dip,5dip,150dip,50dip)
topPanel.AddView(PNlbl,10dip,60dip,150dip,50dip)
topPanel.AddView(PhoneNumber,150dip,60dip,130dip,50dip)
topPanel.AddView(Agelbl,10dip,110dip,130dip,50dip)
topPanel.AddView(YOB,150dip,110dip,130dip,50dip)
 
Top