Android Soft Keyboard: How to manipulate views on keyboard on/off

风流意气都作罢 提交于 2019-12-04 21:38:15

I got this to work by changing the above method a bit:

  • Wrapped the entire layout with a FrameLayout

  • subclassed the FrameLayout and provided the activity the option to register a callback on the layout's OnMeasure

This gives the activity a chance to change visibility of views before these are measured.

I would still be very happy to hear about simpler solutions, especially in regards to figuring out whether the keyboard is currently visible or not. (dumpsys window shows this information. Can we easily get to it?)

Have you tried to call myView.invalidade() ?

I was using the GONE property, but then changed to button.setVisibility(View.INVISIBLE); because I don't have any other stuff on my screen.

on the adjust_resize, you will need to check again when the keyboard has gone and show the buttons again.

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