Android Question Soft Keyboard covering edittext1

alexwekell

Member
Licensed User
Longtime User
I create my views:

B4X:
Sub Activity_Create(FirstTime As Boolean)
If File.Exists(File.DirDefaultExternal, "newsettings2.txt") = False Then
              StartActivity(directions)
        File.OpenOutput(File.DirDefaultExternal, "newsettings2.txt", False)
        Else
        End If
                          
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")  
Activity.AddMenuItem("Live mode","LiveMode")

hiddenet.Initialize("")
Activity.AddView(hiddenet, 10000000dip, 100000dip, 100000dip, 10000dip)

card1.Initialize("")
card2.Initialize("")

SetNinePatchDrawable(card1, "label_bg")
SetNinePatchDrawable(card2, "label_bg")

card1.SendToBack
card2.SendToBack

Activity.AddView(card1, 10dip, 10dip, 100%x-20dip, 50%y-10dip)
Activity.AddView(card2, 10dip, 50%y+10dip, 100%x-20dip, 50%y-20dip)

Activity.LoadLayout("layout1")

button1.top = 50%y-60dip
button1.Width = card1.Width
button1.Height = 60dip
button1.TextSize = 22
button1.Color = Colors.Transparent
button1.TextColor = Colors.rgb(66,133,244)

Button2.top = 100%y-70dip
Button2.Width = card1.Width
Button2.Height = 60dip
Button2.TextSize = 22
Button2.Color = Colors.Transparent
Button2.TextColor = Colors.rgb(66,133,244)

rad1box.Width = 80dip
rad1box.TextColor = Colors.Gray
rad1box.top = 50dip
rad1box.Left = 60dip
rad1box.height = 40dip
rad1box.InputType = rad1box.INPUT_TYPE_NUMBERS
rad1box.TextSize = 24
rad1box.Typeface = robotolight

rad2box.Width = 80dip
rad2box.TextColor = Colors.Gray
rad2box.top = 140dip
rad2box.Left = 60dip
rad2box.height = 40dip
rad2box.InputType = rad2box.INPUT_TYPE_NUMBERS
rad2box.TextSize = 24
rad2box.Typeface = robotolight

edittext1.Initialize("edittext1")
Activity.AddView(edittext1,0dip,0dip,0dip,0dip)
edittext1.BringToFront
edittext1.Width = 120dip
edittext1.TextColor = Colors.Gray
edittext1.top = card2.top + 60dip
edittext1.Left = 40dip
edittext1.ForceDoneButton = True
edittext1.height = 40dip
edittext1.InputType = rad2box.INPUT_TYPE_NUMBERS
edittext1.TextSize = 24
edittext1.Typeface = robotolight
edittext1.Gravity = Gravity.CENTER_HORIZONTAL + Gravity.CENTER_VERTICAL

Label2.top = rad2box.top-43dip
Label2.TextColor = Colors.LightGray
Label2.TextSize = 30
Label2.Typeface = robotolight
Label2.Left = 50%x

Dim equallabel2 As Label
equallabel2.Initialize("")
Activity.AddView(equallabel2, 0dip, 0dip, 30dip, 30dip)
equallabel2.Text = "="
equallabel2.top = edittext1.top-3dip
equallabel2.TextColor = Colors.LightGray
equallabel2.TextSize = 30
equallabel2.Typeface = robotolight
'equallabel2.Left = 190dip
equallabel2.Left = 50%x

Dim degsymbol As Label
degsymbol.Initialize("")
Activity.AddView(degsymbol, 0dip, 0dip, 20dip, 20dip)
degsymbol.Text = "°"
degsymbol.Left = edittext1.Left+ 100dip
degsymbol.top = edittext1.top
degsymbol.TextSize = 24
degsymbol.textColor = Colors.Gray
degsymbol.Typeface = robotolight

Label3.top = rad2box.top-44dip
Label3.TextColor = Colors.Gray
Label3.TextSize = 30
Label3.Left = 170dip
Label3.Width = 200dip
Label3.Typeface = robotolight

Dim label5 As Label
label5.Initialize("")
Activity.AddView(label5, 0dip, 0dip, 10dip, 10dip)
label5.top = card2.top+43dip
label5.TextColor = Colors.LightGray
label5.TextSize = 30
label5.Typeface = robotolight
label5.Left = 190dip

label4.top = card2.top+140dip
label4.TextColor = Colors.Gray
label4.TextSize = 24
label4.Width = card2.Width
label4.Typeface = robotolight
label4.Text = " "

radresultnum.top = card2.top+30dip
radresultnum.TextColor = Colors.Gray
radresultnum.TextSize = 24
radresultnum.Width = card2.Width
radresultnum.Typeface = robotolight
radresultnum.Left = 100dip

radresultden.top = card2.top+95dip
radresultden.TextColor = Colors.Gray
radresultden.TextSize = 24
radresultden.Width = card2.Width
radresultden.Typeface = robotolight
radresultden.Left = 100dip

Dim label9 As Label
label9.Initialize("")
Activity.AddView(label9, 0dip, 0dip, 20dip, 40dip)
label9.Text = "π"
label9.Typeface = robotolight
label9.TextColor = Colors.Gray
label9.TextSize = 24
label9.Left = radresultnum.Left + 205dip
label9.top = radresultnum.top

Dim label8 As Label
label8.Initialize("")
Activity.AddView(label8, 0dip, 0dip, 20dip, 40dip)
label8.Text = "π"
label8.Typeface = robotolight
label8.TextColor = Colors.Gray
label8.TextSize = 24
label8.Left = rad1box.Left + 80dip
label8.top = rad1box.top

c1.Initialize(card1)
c1.DrawLine(card1.Left-8dip, button1.top, 100%x-22dip, button1.top, Colors.LightGray, 1dip)
c1.DrawLine(rad2box.Left-20dip, rad2box.top-28dip, rad2box.Left+80dip, rad2box.top-28dip, Colors.LightGray, 1dip)

c2.Initialize(card2)
c2.DrawLine(card2.Left-8dip, 190dip, 100%x-22dip, 190dip, Colors.LightGray, 1dip)
c2.DrawLine(equallabel2.Left+30dip, 79dip, equallabel2.Left+130dip, 79dip, Colors.LightGray, 1dip)
Activity.Invalidate

Dim topcard As Panel
Dim bottomcard As Panel

End Sub

and edittext1 is ok the first time it's touched, but if I press done or press the down arrow to dismiss the keyboard and try and edit it again then the keyboard covers it.

I have added the line to my manifest that was supposed to fix it, but it didn't help:

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14"/>
<supports-screens android:largeScreens="true"
    android:screenOrientation="portrait"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo.Light")
SetApplicationAttribute(android:label, "$LABEL$")
SetActivityAttribute(Main,  android:windowSoftInputMode, "stateHidden|adjustPan")
'End of default text.
 
Top