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.

Precondition

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

Case 1: switching from the panel to the keyboard

Rule:

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

Rule:

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.



Switching between the panel and the keyboard in Wechat
https://blog.dreamtobe.cn/2015/02/07/Switching-between-the-panel-and-the-keyboard/
作者
Jacksgong
发布于
2015年2月7日
许可协议