Android Question B4XDialog and IME

Sergey_New

Well-Known Member
Licensed User
Longtime User
The B4XDialog contains an EditText element.
When focus is received, the keyboard overlaps the input field.
How do I change the position of the B4XDialog?
 

Sergey_New

Well-Known Member
Licensed User
Longtime User
Did you put it after you initialized the dialog?
Yes. First when opening:
B4X:
Dialog.PutAtTop = False
After placing the cursor on the EditText, need to move the dialog up.
This code doesn't work:
B4X:
Sub IME_HeightChanged (NewHeight As Int, OldHeight As Int)
'...
    Dialog.PutAtTop = True
'...
End Sub
But even if this code worked, this offset might not be enough.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
After placing the cursor on the EditText, need to move the dialog up.
Try this Sergey. I have it in one of my projects and it worked for me:
B4X:
Sub ime_HeightChanged (NewHeight As Int, OldHeight As Int)   
    Dialog.base.Top = NewHeight-Dialog.base.Height
End Sub
By the way, that is the wrong place where you put this line in post5 Dialog.PutAtTop = True
 
Last edited:
Upvote 0
Top