Android Question IMEX Keyboard layout

Rusty

Well-Known Member
Licensed User
I am using a small device (Samsung S7 for example, not a tablet) in landscape mode to enter an ID and Password into individual edittexts.
When the IMEX keyboard comes up, it covers the entire screen and the user can't see anything except the keyboard and the IMEX version of the edittext field.
Is there a way to shrink the "input area" (where the edittext field is displayed) so that the keyboard and display do not cover the entire screen and the input area is only as large as it needs to be?
I tried:
B4X:
Sub edtID_FocusChanged (HasFocus As Boolean)
    If HasFocus Then
        Dim Ref As Reflector
        Ref.Target = edtID
        Ref.RunMethod2("setImeOptions", 268435456, "java.lang.int") 'IME_FLAG_NO_EXTRACT_UI
        IMEx.ShowKeyboard(edtID)
...
End Sub
This doesn't work.
UPDATE: It doesn't work the first time the edtID gains focus and the above code is executed. However, if I click the DONE button and then cause the focuschanged event to fire again, the keyboard is correct. …?? no idea why...??
Further, every time the focuschanged event fires the process starts over again with the keyboard covering the entire screen; touch DONE button and it shrinks appropriately; do the data entry; Done button; re-focus the edtID edittext and the screen is covered again...
Any suggestions?
Thanks,
Rusty
 
Last edited:

Erel

Administrator
Staff member
Licensed User
Set this option right after you load the layout. Don't wait for the focus event.
 

Rusty

Well-Known Member
Licensed User
Thanks Erel,
I've tried this alone and also upon Layout load; and also after layout load AND upon focus...
B4X:
Sub Activity_Create(FirstTime As Boolean)

...

    Activity.LoadLayout("Security")
    Dim Ref As Reflector
    Ref.Target = edtID
    Ref.RunMethod2("setImeOptions", 268435456, "java.lang.int")
    Ref.Target = edtPassword
    Ref.RunMethod2("setImeOptions", 268435456, "java.lang.int")
...
End Sub
 
 ...
 
previously posted focus event code (see above post)
Still no happiness
 

Erel

Administrator
Staff member
Licensed User
More elegant:
B4X:
 Dim Ref As Reflector
For Each et As EditText In Array(edtID, edtPassword)
    Ref.Target = et
    Ref.RunMethod2("setImeOptions", 268435456, "java.lang.int")
Next
Your best option is to use B4XPreferencesDialog.

Please upload a small program that demonstrates the issue.
 

Rusty

Well-Known Member
Licensed User
The attached is a small application that demonstrates the problem.
I should note that as I was building this example, I tested each step as I copied code into it.
At first the IMEX keyboard was working until I added the class INPUTTYPE, which sets the inputtype for both edittext views.
Then my problem began.
I need to be able to set the input types as well as hide suggestions and to not show the settings bar at the top of the keyboard, thus the InputType class.
I appreciate your help, ideas and suggestions...
Rusty
 

Attachments

Last edited:

Erel

Administrator
Staff member
Licensed User
Changing the input type also affects the ime options. Move the code that sets the ime options to the end of Activity_Create.
 
Top