I have two panels in my activity view. One is on the top and one in the bottom. In both of them I have few edit text views. How I Can move up the bottom panel up when the keyboard shows up? . In my case keyboard cover the panel.
Thank You
Now when I click on edittext view which is a part of bottom panel, entire panel moves up (when keyboard shows up). Unfortunately it happens also when I click on edittext view which belongs to top panel. When it happens bottom panel covers top panel and I have no more access to top one.
You can add a global variable that will save the focused EditText. You can then choose how to react to the HeightChanged event based on the focused EditText.
I made a simple example. Two panels with 2 edit text views. My goal is to move bottom panel so it covers top one, when keyboard is activated.
Thank You
Sub Globals
Dim IME As IME
Dim pnl_top As Panel
Dim pnl_bottom As Panel
Dim edt_text_top As EditText
Dim edt_text_bottom As EditText
Dim focusedEditText As EditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
IME.Initialize("IME")
IME.AddHeightChangedEvent
Activity.LoadLayout("Layout1")
End Sub
Sub IME_HeightChanged (NewHeight As Int, OldHeight As Int)
If focusedEditText = edt_text_bottom Then
If NewHeight < OldHeight Then
pnl_bottom.Top = 0
Else
pnl_bottom.Top = 50%y
End If
End If
End Sub
Sub edt_text_top_FocusChanged (HasFocus As Boolean)
If HasFocus Then focusedEditText = Sender
End Sub
Sub edt_text_bottom_FocusChanged (HasFocus As Boolean)
'note that you can use the same sub by setting the EventName of the EditTexts
If HasFocus Then focusedEditText = Sender
End Sub
I'm not sure this is the right place to post this but this is where I found my answer.
From experimenting it seems that wherever you give any view a .visible = false the edittext view will not slide (don't know if that is the right term) above the keyboard. If you don't touch the .visible, Android seems to handle the slide by itself. The fix was to use the IME library and change the height of the panel the views are on. Changes to the manifest and other suggestions on working around this issue did not work.
My comment/question is that this seems to be a bug in .visible or is this a feature? My project doesn't need the IME library and the associated coding except to handle this .visible issue.