键盘问题,同时关注Android中的底部编辑文本 [英] Keyboard issue while focusing on bottom edit text in Android

查看:120
本文介绍了键盘问题,同时关注Android中的底部编辑文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个Android应用程序,我愿意从用户那里获取输入.我为其创建了一个布局,该布局具有一个滚动视图作为根视图&相对布局,因为它是所有其他布局的子元素,因此都位于此相对布局内.但是,当编辑文本位于屏幕底部时,用户点击该按钮将其带到键盘上,该键盘在编辑文本和&键盘和此后,如果用户输入任何单词,则不会在编辑文本中显示该单词.但是,如果编辑文本"几乎超过屏幕大小的一半,则可以正常工作.您可以通过查看下面的图片来更清楚地了解

I am working on an android Application where I am willing to get input from user. I created a layout for it which has a scroll view as a root view & Relative layout as it's child all the other layout are inside this Relative layout. But when edit text is at the bottom of screen & user click on it to bring keyboard it shows some blank box between edit text & keyboard & after this if user enters any word it doesn't get displayed in edit text. But if Edit text is above nearly more then half size of screen it works fine. You can get more clearly by looking at images below

这是我的代码

有人遇到这种问题吗?请帮忙!!!

Does anyone faced this kind of problem?? Please help!!!

推荐答案

在清单中的活动( android:windowSoftInputMode ="adjustPan" )上设置的默认IME模式将平移主布局,因此文本字段在可见区域的中间.当您的大部分内容都位于可滚动区域中时,它只是在移动整个区域而不是将内容滚动到视图中.如果您使用 android:windowSoftInputMode ="adjustNothing" ,它将阻止布局平移,但实际上不会做任何事情,仅覆盖您的原始输入即可.

The default IME mode set on the activity in the manifest (android:windowSoftInputMode="adjustPan") will pan the main layout so the text field is in the middle of the viewable area. While the majority of your content is in a scrollable region, it is simply moving the whole region and not scrolling the contents into view. If you use android:windowSoftInputMode="adjustNothing" it will prevent the layout panning, but will also effectively do nothing and just cover your original input.

我的建议是使用adjustResize,这可能会为您解决.如果没有,则必须考虑进行一些自定义滚动区域聚焦.

MY recommendation would be to use adjustResize, this might fix it for you. If not, you have to look into doing some custom scroll-region focusing.

这篇关于键盘问题,同时关注Android中的底部编辑文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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