键盘布局隐藏android操作栏?
在 XOOM 设备中运行的 Android 应用程序中,当我单击 Edittext 时,键盘会打开并隐藏操作栏。我不希望这种情况发生,我该如何解决?例如,这是通过平板电脑的 Google 通讯录应用程序完成的。
编辑: 我有几个编辑文本,用户需要填写。一开始,当用户单击底部的一个编辑文本时,键盘会出现并隐藏用户正在输入的编辑文本,因此他看不到自己正在输入的内容。我发现它非常糟糕,为了解决它,我刚刚添加到清单中: android:windowSoftInputMode="stateVisible|adjustPan"
但在那之后,现在屏幕会自行调整并隐藏操作栏。
Google 通讯录应用程序也执行相同的操作,但它神奇地不会隐藏操作栏。他们是如何做到的?
In my Android application running in a XOOM device, when I click in an Edittext the keyboard opens and hides the Actionbar. I don't want this to happen, how can I solve this? This is done by the Google Contacts app for the tablet for example.
EDIT:
I have several edittexts in which the user needs fo fill. At first, when the user clicked on one edittext on the bottom, the keyboard showed up and hide the edittext in which the user was typing, so he couldn't see what he was typing. I found it really bad, and to solve it I just added to the manifest: android:windowSoftInputMode="stateVisible|adjustPan"
But after that, now the screen adjust itselfs and hides the action bar.
The Google Contacts app does the same, but it magically doesn't hide the Action bar. How do they do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
adjustResize
而不是adjustPan
。如有必要,框架将始终尝试通过滚动任何父视图来将焦点元素保持在屏幕上。如果您的 EditText 字段未嵌套在某种滚动容器(例如 ScrollView)中,那么当键盘调整 Activity 大小时,您的布局可能太高而无法完全显示。尝试将表单的布局包装在 ScrollView 中。如果您的应用程序在较小屏幕设备上运行,并且可能存在类似问题,这也将允许您的应用程序内容滚动。
Use
adjustResize
instead ofadjustPan
. The framework will always try to keep the focused element on-screen by scrolling any parent views if necessary.If your EditText field is not nested in some sort of scrolling container such as a ScrollView then your layout may be too tall to completely display when the keyboard resizes your activity. Try wrapping your form's layout in a ScrollView. This will also allow your app's content to scroll if it is running on a smaller screen device where it may have similar issues.