Sub EditText_FocusChanged (HasFocus As Boolean)
If HasFocus Then
FocusedField = Sender
UpdateLayoutIfNeeded
Else
Dim FocusedField As EditText 'it will be uninitialized
End If
End Sub
Private Sub ime_HeightChanged (NewHeight As Int, OldHeight As Int)
If NewHeight < OldHeight Then
KeyboardSize = OldHeight - NewHeight
Else
KeyboardSize = 0
End If
UpdateLayoutIfNeeded
End Sub
Private Sub UpdateLayoutIfNeeded
If FocusedField.IsInitialized = False Then Return
Dim LowestVisiblePointRelativeToSV As Int = 100%y - KeyboardSize - 50dip '50dip = tab height
If FocusedField.IsInitialized Then
Dim fieldBottom As Int = FocusedField.Top + FocusedField.Height + 2dip
Dim p As Panel = FocusedField.Parent
Dim sv As ScrollView = p.Parent
sv.ScrollPosition = fieldBottom - LowestVisiblePointRelativeToSV
End If
End Sub