Android Question EditText and show soft Keyboard

AlpVir

Well-Known Member
Licensed User
Longtime User
How to catch the event that makes visible the soft keyboard ?
The IME Library does not seem to fit the bill.
If I have an app in portrait format and an EditText at the bottom, typing is not optimal (the EditText is hidden by the soft keyboard).
It would be easy to temporarily move the EditText at the top, but it should intercept the event mentioned above.
The following sub is also not optimal
B4X:
Sub EditText1_TextChanged (Old As String, New As String)
    '--- move EditText1 at the top
     EditText1.SetLayout (0dip,0dip,100%x,100%y)
End Sub
Thanks in advance.
 

LucaMs

Expert
Licensed User
Longtime User
I do not know if this code is correct, but:


B4X:
    IME1.Initialize("IME1")
    IME1.AddHeightChangedEvent

'...


Sub IME1_HeightChanged(NewHeight As Int, OldHeight As Int)
    ' NewHeight is the keyboard.top
    Dim KeyboardVisible As Boolean
    KeyboardVisible = (NewHeight < OldHeight)

    If Not(KeyboardVisible) Then
        ' Set here the EditText1 original top position
    Else

        If NewHeight < edtPrz.Top Then
            edtPrz.Top = NewHeight-EditText1.Height
        End If

    End If

End Sub
 
Upvote 0

merlin2049er

Well-Known Member
Licensed User
Longtime User
"try this line in the manifest editor: SetActivityAttribute(main, android:windowSoftInputMode, adjustPan|stateHidden)"

tip from tds.
 
Upvote 0

EvgenyB4A

Active Member
Licensed User
Longtime User
Hi
Is it possible to hide the "Settings" button of the keyboard to prevent from user to change the keyboard settings?
 
Upvote 0
Top