找到虚拟键盘的顶部象素的位置? [英] Finding the top pixel location of the virtual keyboard?

查看:137
本文介绍了找到虚拟键盘的顶部象素的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法找到虚拟键盘的顶部位置?我想直接放在一个视图上面时,它的开放。是这样的:

Is there a way to find the top position of the virtual keyboard? I'd like to place a view directly above it when it's open. Something like:

 -----------------------------
 | my linear layout | button |
 -----------------------------  <-- what's this y position?
 |                           |
 |    virtual keyboard       |
 |                           |

我想我可以重新定位我的看法,当键盘打开,只要我知道键盘的顶部边缘。或者,也许相反,有一些类型的布局我可以用这使视图相同Z水平为键盘,只是其引脚自动键盘的顶部?这会是弧度。

I figured I could reposition my view when the keyboard is open so long as I know where the top edge of the keyboard is. Or maybe instead, there's some kind of layout I can use which puts a view in the same z level as the keyboard, and just pins it to the top of the keyboard automatically? That'd be rad.

感谢

推荐答案

您已经设置您的视图对齐一个选项:parentBottom =真正的

One option that you have is set your view to align:parentBottom="true"

然后在你的清单认沽的android:windowSoftInputMode =adjustPan上,你是在活动这将让这个被对齐的底部你的观点会跳上来就软键盘上方,而它是开放的。

then in your manifest putandroid:windowSoftInputMode="adjustPan" on the activity that you are in. This will make it so that your views that are aligned bottom will jump up on top of the soft keyboard while it is open.

这篇关于找到虚拟键盘的顶部象素的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆