问题描述
我有EditText,当我按下此按钮时,将显示键盘,但是它没有覆盖应用程序的底部,而是将所有元素移到顶部并使它们变小,从而使所有内容看起来都失真了...
如何显示键盘,以免影响我们的布局?
I have EditText, when i toutch this, keyboard will show, but instead of covering the bottom part of the application, it shifts all the elements at the top and makes them smaller, everything looks distorted ...
How do I display the keyboard so that it does not affect our layout?
推荐答案
请检查此链接:
您可以为要防止此类问题的活动添加清单.还要确保如果您还有更多内容,请使用scrollView作为父项.软输入模式为"adjustResize"
You can add in your menifest for the activity you want to prevent such issue.Also make sure if you are having a bit more content use scrollView as a parent.And soft input mode as "adjustResize"
android:windowSoftInputMode="adjustResize"
或
android:windowSoftInputMode="adjustPan"
您可以根据需要使用.
请确保使用此布局来确保系统将布局的大小调整为可用空间,以确保可以访问所有布局内容(即使可能需要滚动).
to ensure that the system resizes your layout to the available space—which ensures that all of your layout content is accessible (even though it probably requires scrolling)—use this one.
adjustPan
该活动的主窗口没有调整大小以为软键盘腾出空间,并且该窗口的内容会自动平移,以使当前的焦点不会被键盘遮挡,并且用户始终可以看到他们正在键入的内容.
The activity's main window is not resized to make room for the soft keyboard, and the contents of the window are automatically panned so that the current focus is never obscured by the keyboard and users can always see what they are typing.
adjustNothing
对布局不执行任何操作
这篇关于EditText销毁布局的键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!