键盘布局掩盖视图下方的EditText想保持可见 [英] Keyboard placement obscures view below EditText would like to keep visible

查看:332
本文介绍了键盘布局掩盖视图下方的EditText想保持可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个活动,基本上是输入域的长形式。
在每一行,我想表明一个TextView作为提示文本只是每个下面的EditText,我想TextView的当用户输入的数据在任何时候都保持可见。不幸的是,软键盘掩盖了提示文字和总是立即将自身定位在下面的EditText。是否有任何技术将允许的EditText下方的TextView当软键盘显示并且内容被调整(通过windowSoftInputMode = adjustResize | adjustPan)也可见?,而无需用户滚动

I have an activity that is basically a long form of entry fields. On each row, I want to show a TextView to serve as hint text just below each EditText and I want the TextView to remain visible at all times when the user is entering data. Unfortunately, the soft keyboard obscures the hint text and always positions itself immediately below the EditText. Is there any technique that will allow the TextView below the EditText to also be visible when the soft keyboard appears and the contents are adjusted (via windowSoftInputMode=adjustResize|adjustPan), without having the user scroll ?

推荐答案

编辑:
通过更深入地了解这个问题,我认为你应该当用户点击EDITTEXT编程添加滚动。这里是code要做到这一点:

By understanding the problem more deeply, I think that you should add scroll programatically when user clicks on the Edittext. Here is the code to do that:

private final void focusOnView()
{ 
 new Handler().post(new Runnable() 
 { 
 @Override
 public void run() 
 { 
 your_scrollview.scrollTo(0, your_EditBox.getBottom()); 
 }}); 
 }

从我个人的经验,我觉得不存在这样的方式来做到这一点。你可以做的事情是把提示的TextView toRightOf的editext。或通过EDITTEXT一个占位符提示用现代的方法:

From my personal experience I think there is not such way to do that. The thing you can do is place the hint textview toRightOf the editext. Or Use modern Approach by using a Hint Placeholder on Edittext:

在XML中,它只是的android:提示=SomeText则会

通过编程可以使用 edittext.setHint(INT);

通过R.string.somestring在上面的方法。

pass R.string.somestring in above method.

这篇关于键盘布局掩盖视图下方的EditText想保持可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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