如何使键盘打开/关闭事件后视图改变 [英] How to make view change after keyboard open/close event

查看:120
本文介绍了如何使键盘打开/关闭事件后视图改变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从读数,我有软键盘与onSizeChanged方法的高度。我想要做的很到位,当它被关闭软键盘显示的列表,并删除当再次需要键盘的列表中。

From readings, I have the height of the soft keyboard with the onSizeChanged method. What I want to do is to display a list in place of the soft keyboard when it is closed, and remove the list when the keyboard is required again.

我做的,此刻的方式是,当一个按钮pssed $ P $,名单将变为可见,并使用InputMethodManager键盘驳回。在按钮的onClick方法的问题,我设置列表可见,但键盘隐藏动画仍在进行中。这将导致明显的闪烁的情况发生,因为设置可视化的通话触发布局要重做,并在键盘仍然存在,推淡出人们的视线其他视图顶端的名单变得可见。键盘动画完成后,其他次再次变得可见,这过程会导致可见的闪烁...

The way I'm doing it at the moment is that when a button is pressed, a list will be made visible and the keyboard dismissed using the InputMethodManager. The problem in the button's onClick method, I set the list to be visible, but the keyboard hiding animation is still ongoing. This causes a visible flicker to happen, since the set visible call triggers the layout to be redone, and the list becomes visible while the keyboard is still there, pushing other views out of sight to the top. After the keyboard animation is finished, other views become visible again, this process causes a visible flicker...

任何人有,我应该如何处理这有什么建议?
拉我的头发的那一刻,因为设置列表onLayout或onSizeChanged中可见不让列表可见...

Anyone got any suggestions on how I should approach this?? Pulling my hair at the moment, since setting the list visible during onLayout or onSizeChanged doesn't let the list become visible...

谢谢!
戴夫。

Thanks!!! Dave.

推荐答案

您可以实施 onConfigurationChanged(配置)在您的活动方法。同时,为了叫你应该在你的清单文件中添加信息,在什么情况下该方法应被称为像指定此方法:

you can implement onConfigurationChanged(Configuration) method in your activity. Also, to get this method called you should add information in your manifest file to specify in what situations the method should be called like that:

android:configChanges="keyboardHidden|orientation"

了解详情。

这篇关于如何使键盘打开/关闭事件后视图改变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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