安卓:我怎样才能知道,如果软键盘显示或不? [英] Android: how can i tell if the soft keyboard is showing or not?

查看:170
本文介绍了安卓:我怎样才能知道,如果软键盘显示或不?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

继承人的难题: 我显示与3个输入字段和一个标签的内侧2个按钮的画面(有3个标签总,和它们是在屏幕的底部)。 2个按钮被设置为左下方,屏幕的右侧,右侧的选项卡上方。当我点击输入框,标签和按钮都推高了键盘的顶部。

Heres the dilemma: I am showing a screen with 3 input fields and 2 buttons inside of a tab(there are 3 tabs total, and they are on the bottom of the screen). the 2 buttons are set to the bottom left and right of the screen, right above the tabs. when i click on an input field, the tabs and buttons are all pushed up on top of the keyboard.

我的愿望只是按动按钮了,离开他们原来是标签,在底部。我想设置的选项卡GONE的知名度,一旦我决定了软键盘显示,和知名度为可见,一旦软键盘消失了。

i desire to only push the buttons up, and leave the tabs where they originally are, on the bottom. i am thinking of setting the visibility of the tabs to GONE once i determine that the soft keyboard is showing, and visibility to VISIBLE once the soft keyboard is gone.

有一些听众的软键盘,或者输入字段?也许有些棘手使用 OnFocusChangeListener 为编辑文本?如何确定键盘是否可见或不?

is there some kind of listener for the soft keyboard, or maybe the input field? maybe some tricky use of OnFocusChangeListener for the edit text? How can i determine whether the keyboard is visible or not?

推荐答案

确定是否正显示出键盘是不可能明显。

Determining if the keyboard is showing is not possible apparently.

您可能想在你的清单中的 windowSoftInputMode XML标记产品总数禁用它:的 http://developer.android.com/reference/android/R.attr.html#windowSoftInputMode 。或者你可以对如何移除焦点隐藏键盘一看:<一href="http://stackoverflow.com/questions/3922718/hide-soft-keyboard-on-activity-without-any-keyboard-operations">Hide软键盘上的活动,没有任何键盘操作。

You might want to disable it alltogether with the windowSoftInputMode xml tag in your manifest: http://developer.android.com/reference/android/R.attr.html#windowSoftInputMode. Or you can have a look on how to remove focus to hide the keyboard: Hide soft keyboard on activity without any keyboard operations.

亦不会完全解决你的问题。我记得读的博文强烈建议不要使用标签的底部,而不是在屏幕的顶部,为用户界面清楚的原因。我建议你​​跟进了。

Neither will exactly solve your problem. I remember reading a blogpost strongly advising not to use tabs at the bottom, rather than the top of the screen, for UI clarity reasons. I recommend you to follow up on that.

这篇关于安卓:我怎样才能知道,如果软键盘显示或不?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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