Sub Globals
' ...
Dim inputPanelPos As Int ' Bottom of focussed text panel
Dim workHeight As Int = 0 ' Current keyboard height
' ...
End Sub
' Calculate position of base of currently focussed text panel
Private Sub text_FocusChanged (HasFocus As Boolean)
Dim v As EditText = Sender
Dim p As Panel = v.Parent
If HasFocus Then inputPanelPos = p.top + p.Height
If (workHeight > 0) Then scrBase.ScrollPosition = inputPanelPos - workHeight
End Sub
Private Sub IME_HeightChanged (NewHeight As Int, OldHeight As Int)
If (NewHeight < OldHeight) Then ' Keyboard is open
workHeight = NewHeight
scrBase.SetLayout(0, 0, Activity.Width, NewHeight)
scrBase.ScrollPosition = inputPanelPos - NewHeight
Else
scrBase.SetLayout(0, 0, Activity.Width, Activity.Height)
workHeight = 0 ' Keyboard closed
End If
End Sub