简体   繁体   English

键盘出现时如何移动输入布局

[英]How to move the input layout go up when the keyboard appears

I'm sorry if any similar question has been resolved in other topics. 对于其他主题是否解决了任何类似的问题,我们深感抱歉。 I have a screen with the root is a frame layout. 我的屏幕根部是框架布局。

  • The layout in back contains a lot of content 后面的布局包含很多内容
  • The layout in front contains an edit text to allow user enter some text. 前面的布局包含一个编辑文本,以允许用户输入一些文本。 Normally, it put at the bottom of the screen. 通常,它放在屏幕底部。

What I expected is when the keyboard appears, the layout contains content is keep unchanged while the layout contains edit text move up to the keyboard. 我期望的是,当键盘出现时,包含内容的布局保持不变,而包含编辑文本的布局向上移动到键盘。

Please check the images below 请检查下面的图片

在此处输入图片说明

Is there any solution to achieve this? 有什么解决方案可以做到这一点吗?

Thanks a lot for your help. 非常感谢你的帮助。

Basically what you need is to edit the activity tag in your AndroidManifest.xml : 基本上,您需要在AndroidManifest.xml编辑activity标签:

   <!-- Configures the keyboard to be hidden right away and for UI to keep content as is when shown -->
   <activity
    android:name="com.example.myactivity"
    android:windowSoftInputMode="stateHidden|adjustPan" />

more info can be found here . 更多信息可以在这里找到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM