0 votes

I'm making a chat app using Godot (and PHP/MySQL for the backend) and it's done, but it gets hidden by the android keyboard when I type anything.

Is there any way to have the whole screen move up when the keyboard opens, and move back down when it closes, like in some applications?

Thanks in advance!

Godot version Godot Engine 3.3.3 (Steam)
in Engine by (87 points)

1 Answer

+1 vote

If you are using Control nodes and they are not anchored you can resize the chat area by subtracting the keyboard height

#store the height to later reset it
var old_height = $chat_node.rect_size.y

#on keyboard shown
var kb_height = OS.get_virtual_keyboard_height()
$chat_node.rect_size.y -= kb_height.y

#on keyboard hidden
$chat_node.rect_size.y = old_height
by (4,560 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.