How to make view change after keyboard open/close event

喜你入骨 提交于 2019-12-25 14:12:07

问题


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.

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...

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.


回答1:


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"

Look here for additional details.



来源:https://stackoverflow.com/questions/4448062/how-to-make-view-change-after-keyboard-open-close-event

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!