android显示软键盘时如何向上移动布局 [英] How to move the layout up when the soft keyboard is shown android

查看:40
本文介绍了android显示软键盘时如何向上移动布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的布局中有一个带有两个 EditTexts 的登录屏幕和一个登录按钮.问题是,当我开始打字时,会显示软键盘并覆盖登录按钮.当布局出现时,如何将布局向上或推到键盘上方?

I have a login screen with two EditTexts and a login button in my layout. The problem is that, when I start typing, the soft keyboard is shown and covers the login button. How can I push the layout up or above the keyboard when it appears?

我不想使用 ScrollView,只想在不向下滚动的情况下实现它.请给我建议一些方法.提前致谢.

I do not want to use a ScrollView, just want to implement it without scrolling down. Please, suggest me some way of doing it. Thanks in advance.

推荐答案

我通过了解设备软键盘的状态以某种方式实现了这一点.当显示键盘时,我将布局移动到 y 位置,并在未显示时移回其原始位置.这工作正常,遵循本指南.

I somehow achieved this by knowing the status of the soft keyboard on the device. i move the layout to y position when the keyboard is shown and moved back to its original position when not shown. this works fine, followed this guidelines.

这篇关于android显示软键盘时如何向上移动布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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