Is it possible to change the keyboard layout on the screen?

vecino

Well-Known Member
Licensed User
Longtime User
Hello, in 'portrait' the keyboard is down and you can see what's on the top of the screen.
9267995071_7275f793f1_o.jpg


In 'landscape', the keyboard takes up the whole screen and you can not see what's underneath.
9270779762_7c3b8ae29d_o.jpg


Is it possible to get something like this?
9270779668_ac10740052_o.jpg


Thanks and regards.
 

mc73

Well-Known Member
Licensed User
Longtime User
I think this is handled internally, I've seen it on some tablets I use for testing, 10'' in particular. The way I handled it, without really getting into searching for another solution, was to build a custom keyboard.
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Thanks for the reply, I will seek information to build a custom keyboard.
Thanks and regards.
 
Upvote 0

TomA

Active Member
Licensed User
Longtime User
In 'landscape', the keyboard takes up the whole screen and you can not see what's underneath.

You are getting what is called Extract Mode when your screen is in landscape mode. I ran into the same problem and, after questioning Google, found this was intended behavior on the assumption that there would not be enough space to display anything useful. Even the entry field is not your entry field. To get around this problem, do the following:

Under Sub Globals, define:

Dim Ref As Reflector

and under Activity_Create:

Ref.Target = TextEdit ' The text field being referenced
Ref.RunMethod2("setImeOptions", 268435456, "java.lang.int") 'IME_FLAG_NO_EXTRACT_UI

That should give you back your normal screen in landscape mode.

Of course you will still have to deal with handling the appropriate layout in landscape mode.

Tom Aman
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
Ah, great info, Tom! Wish I had searched before creating custom keyboard...
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Hello, thank you very much.
Ref.Target = TextEdit ' The text field being referenced
I have a question, if I have about 20 EditText on the screen, how do I reference each EditText?

Thanks and regards.
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
It works, but I guess there must be another way.
Greetings.
B4X:
  Reff.Target = EditText1 ' The text field being referenced
  Reff.RunMethod2("setImeOptions", 268435456, "java.lang.int") 
  
  Reff.Target = EditText2
  Reff.RunMethod2("setImeOptions", 268435456, "java.lang.int") 
  
  Reff.Target = EditText3
  Reff.RunMethod2("setImeOptions", 268435456, "java.lang.int")
 
Upvote 0

Caravelle

Active Member
Licensed User
Longtime User
See Erel's answer to my question "Set same attributes for many views" a few pages back in the Forum.

Caravelle
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
How about:

B4X:
Dim MyEditTexts() As EditText=Array As EditText(EditText1, EditText2, EditText3)
For Each MyEditText As EditText In MyEditTexts
    Reff.Target=MyEditText
   Reff.RunMethod2("setImeOptions", 268435456, "java.lang.int") 
Next

Martin.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
You can do something like this:
B4X:
Sub txtBoxes_FocusChanged (HasFocus As Boolean)  'txtBoxes is the event name of the boxes
    If HasFocus Then
         Dim Ref As Reflector
         Dim Send As EditText
         Send=Sender
         Ref.Target = Send                   ' The text field being referenced
         Ref.RunMethod2("setImeOptions", 268435456, "java.lang.int") 'IME_FLAG_NO_EXTRACT_UI 
   End If
End Sub
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
It works, but I guess there must be another way.
Greetings.
B4X:
  Reff.Target = EditText1 ' The text field being referenced
  Reff.RunMethod2("setImeOptions", 268435456, "java.lang.int") 
  
  Reff.Target = EditText2
  Reff.RunMethod2("setImeOptions", 268435456, "java.lang.int") 
  
  Reff.Target = EditText3
  Reff.RunMethod2("setImeOptions", 268435456, "java.lang.int")



Hi vecino,

I think you could do this as belows

Private Sub setImeOptions(edt As EditText,id As Int) As Object
Dim r As Reflector
r.Target = edt
Return r.RunMethod2("setImeOptions", id, "java.lang.int")
End Sub
 
Upvote 0
Top