Android Question [Resolved]Keyboard on panel

Douglas Farias

Expert
Licensed User
Longtime User
hi how can i make to up my painel when the keyboard is opened?

when i press my edittext4 the keyboard hides my EditText

i have 5 edittext on a panel
how can i move up the panel when keyboard is opened
and how i go know the height from keyboard to move up my panel?

have a native solution for this? i tested on my tablet and my tablet have diferent keyboard size too
hide my edittext too
 

LucaMs

Expert
Licensed User
Longtime User
B4X:
IME1.AddHeightChangedEvent

Private Sub IME1_HeightChanged (NewHeight As Int, OldHeight As Int)
    If NewHeight < (Text4.top + Text4.Height) Then
        Text4.Top = NewHeight - Text4.Height
    End If
End Sub

But you have to reset the starting position when the keyboard is closed.
Furthermore, instead of Text4 you will need to use a global variable of type TextBox and set it "equal" (point to) the current EditText (in the FocusChanged event of each of your TextBoxes)
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
confirmacadastro is my panel with 5 edittext inside i tested but dont work
what I did wrong in this code?

when i press one edittext the panel dont go up *-*

B4X:
Dim IME As IME
IME.Initialize("IME")
IME.AddHeightChangedEvent

Private Sub IME1_HeightChanged (NewHeight As Int, OldHeight As Int)
    If NewHeight < (confirmacadastro.top + confirmacadastro.Height) Then
        confirmacadastro.Top = NewHeight - confirmacadastro.Height
    End If
End Sub
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
fixed thx i m used

PrivateSub IME1_HeightChanged (NewHeight AsInt, OldHeight AsInt)
confirmacadastro.top = -30%y
End Sub
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top