Android的软键盘隐藏按钮 [英] Android soft keyboard hides button

查看:237
本文介绍了Android的软键盘隐藏按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有如下所示的简单登录视图。

I do have a simple login view like shown below.

如果任何的EditText 获得焦点,键盘将显示(软)。红色虚线应该概括这种行为:

If any EditText gains focus, the keyboard will be shown (soft). The red dashed line should outline this behavior:

我需要的是,即在底部(注册与安培;帮助)的按钮在无形,而键盘是显示。登录按钮的底端应该是在键盘上,这样既 EditTexts 登录按钮都是可见的。

What I need is, that the Buttons at the bottom (Signup & Help) are invisible while Keyboard is showing. The bottom end of the login button should be over the keyboard, so that both EditTexts and the Login Button are visible.

目前最佳的标志半应该是如果可能的话(取决于屏幕大小)可见

At best half of the Logo should be visible if possible (depending on screen size)

这将是完美的罚款,如键盘是可见的来定义一个额外的布局XML如果可能的话。

It would be perfectly fine to define an extra layout xml like "keyboard is visible" if that's possible.

推荐答案

您可以通过几步管理。当键盘然后弹出执行以下步骤,也可以在方法包装这些...

You can manage it by few steps. When KeyBoard popup then do the following steps or you can wrap these in a method...


  1. 获取窗口的高度。

  2. 确定键盘高度。

  3. 滚动使用键盘上方的高度视图 scrollTo()方法。

  1. Get the window height.
  2. Determine the keyboard height.
  3. Scroll your view above the keyboard height using scrollTo() method.

这篇关于Android的软键盘隐藏按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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