Switching between the panel and the keyboard in Wechat

Somebody ask me, why there are no layout jumping in wechat when switching between the panel and the keyboard?

It’s very simple.

Just 2 cases under 2 rules.


  • Definition android:windowSoftInputMode as adjustSize for Activity in AndroidManifest xml.
  • Already calculated keybord height.

Case 1: switching from the panel to the keyboard


To ensure that gone(or providing zero height) panel during keyboard squeeze layout trigger layout real remeasuring smaller height and redrawing.

Case 2: switching from the keyboard to the panel


To ensure that switching panel to display(visible&valid height) from hidden(gone|no height) state is in the keybord hiding trigger layout real remeasuring more high and redrawing period.

In a word

  • No trigger layout remeasure & redraw by panel.
  • Readjusting panel height during keybord trigger layout remeasuring new height.

any suggestions and questions, welcome to follow post comment.

Jacksgong wechat
欢迎关注Jacks Blog公众号,第一时间接收原创技术沉淀干货。