开发者

How to make view change after keyboard open/close event

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.开发者_StackOverflow..

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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜