如何prevent大小调整和重新布局的窗口时,软键盘显示 [英] How to prevent resizing and relayout the window when soft keyboard displaying

查看:212
本文介绍了如何prevent大小调整和重新布局的窗口时,软键盘显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在展示活动的编辑对话框,当软键盘显示,该活动的窗口将被调整到过哪些劳工处。看起来可怕。 我不希望活动的窗口,调整大小和布局。我只是想键盘可以覆盖活动窗口和对话框移动顶端上,这样软键盘有空间来显示。

I show an edit dialog in an activity, when the soft keyboard displaying, the window of the activity will be resized to too samll which looks awful. I don't want the window of the activity be resized and layout. I just want the keyboard can cover on the activity window and the dialog move to the top so that soft keyboard have room to show.

我曾尝试使用的android:windowSoftInputMode =XXXXX在清单中,但也有它适合我的处境没有任何一种模式。我也发现了类似的<一个href=\"http://stackoverflow.com/questions/5180789/android-how-to-$p$pvent-resizing-the-window-when-displaying-the-virtual-keyboar\">question,但我以前不解决我的问题。

I have tried to use android:windowSoftInputMode="xxxxx" in the manifest, but there are no one mode which fit my situation. I also found the similar question, but it did't solve my problem.

编辑:我曾尝试 setImeOptions getWindown()setFlags ,但它还是我以前不工作,任何意见将是非常美联社preciated。

I have tried setImeOptions and also getWindown().setFlags but it still did't worked, Any advice will be very appreciated.

EDIT2:我试图在3.0,并使用Android:windowSoftInputMode =adjustNothing,它的工作完美,但我怎么能实现这个对2.3

I have tried in 3.0, and use android:windowSoftInputMode="adjustNothing", It worked perfectly, but how can i implement this on 2.3?

推荐答案

我找到一个方法来避免这个问题,只是回避,还是想知道在Android 2.3的解决方案。

I find a method to avoid the problem, but just avoid, still want to know the solution in android 2.3.

之前,我布局的控制,从顶部和底部的XML,就像这样:

Before, I layout the controls in the XML from top and bottom, just like this:

<ToolBar android:id="@+id/blabla"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" />

所以,当键盘显示,该活动的窗口大小,使工具栏推,它看起来并不好。

So when the keyboard is showing, the window of the activity is resized, so the ToolBar is pushed, which looks not good.

现在,我布置的控制从上,通过这个窗口仍调整大小,但工具栏和其他控件不会再推,他们只是布局窗外,当软键盘显示的。

Now, I layout the controls from top, through the window is still resized, but the ToolBar and the other controls will not be pushed, they are just layout out of the window, when the soft keyboard is showing.

这篇关于如何prevent大小调整和重新布局的窗口时,软键盘显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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