如何在LibGDX应用程序中找到软键盘的高度 [英] How can i find the height of soft-keyboard in a LibGDX application
问题描述
我正在使用 LibGDX 开发 Android 游戏.我需要找到用户正在使用的软键盘的高度,因为我想在键盘上方显示一些对象.
I'm developing an Android game with LibGDX. And I need to find the height of the soft-keyboard the user is using, as I want to display some objects right above the keyboard.
我已阅读此线程: 如何在android上获取软键盘高度?
但是该注释表明它不起作用,并且似乎也可以与 Android SDK 一起使用.我不知道.有人知道肯定会有效的方法吗?
But the comment suggests that it doesn't work, and it also seems to be for using with Android SDK. I'm not sure. Does anyone know a way that will definitely work?
推荐答案
如果您的问题是您的文本字段被遮盖了,那么我建议使用
If your problem is that your textfields are obscured then I suggest using
void Gdx.input.getTextInput(Input.TextInputListener listener,
java.lang.String title,
java.lang.String text)
void Gdx.input.getTextInput(Input.TextInputListener listener,
java.lang.String title,
java.lang.String text)
而是因为它将生成一个本机模态文本输入对话框,该对话框可通过键盘上下移动.我也尝试过提高键盘的高度,但到目前为止我还没有解决.
instead because that will generate a native modal text input dialog that moves up and down with the keyboard. I have tried to get the height of the keyboard as well but so far I haven't managed.
也请参见此线程的答案: libgdx如何检测键盘的存在
See answers for this thread as well: How do libgdx detect keyboard presence
这篇关于如何在LibGDX应用程序中找到软键盘的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!