Thank you so much! This works for ios. This does not work for Android For iOS, the height indicates when the keyboard is already hidden.It would be nice if the height was shown only when the keyboard is shown or to make the function of determining the keyboard state. If the height is greater than 0, then the keyboard is shown, if it is 0, then The keyboard is hidden.
For Android and iOS
CoronaWindowMovesWhenKeyboardAppears = true
Another request - can I make a setting to turn off the Bluetooth permission request for iOS
Permission for a bluetooth is no asked. Thanks for this!)
The android shows the wrong height of the keyboard when the keyboard is hidden. At me for example 615px when the keyboard is hidden and 393px when the keyboard is shown.
Yeah the keyboard height and width only works when keyboard is shown. There is a problem with end events on iOS and android. I patched iOS bug.
Edit: so that’s why I cannot set values 0, native textboxes and test fields have event listeners so I recommend that. I don’t know exactly why the keyboard hide phase is not working in native code.
I am a little bit shady on what you mean. Add a user input event to the TextBox and as soon as the TextBox gets in focus I scroll the ScrollView to a vertical center position? I can not see how this could make it possible to implement the UI design I attached to my initial message. I may completely misunderstand what you mean though.
Another way could be to redesign the UI to use a ScrollView for the complete scene and put the TextBox as its bottom part (under any attached images and action buttons). The bottom part of the TextBox would be hidden by the keyboard whenever the keyboard appears. The top part of the TextBox would be visible though. The user starts to write into the TextBox and when the text eventually goes behind/below the keyboard it’s up to the user to scroll. This would not require any user input event handlers but the UX would (may) be a bit strange. The UI design used for this would not look as my UI mate planned for but rather as seen in this link:
I solved this with a native Java plugin for Android which calculates the available vertical space above the keyboard. I will do something similar for iOS later (my immediate need is to conclude an Android prototype).
With this plugin I can achieve the exact layout I want above the keyboard.
A main.lua example:
display.setStatusBar(display.HiddenStatusBar) local \_W = display.contentWidth local dummyTextField = native.newTextField(-20, -20, 10, 10) native.setKeyboardFocus(dummyTextField) local function render() dummyTextField:removeSelf() local spaceAboveKeyboard = SpaceAboveKeyboard.calculate() local textBox = native.newTextBox(\_W / 2, spaceAboveKeyboard / 2, \_W, spaceAboveKeyboard) textBox.isEditable = true native.setKeyboardFocus(textBox) end timer.performWithDelay(1000, render)
I updated android/app/src/main/AndroidManifest.xml like this: