Problem Profile: Horizontal Board COCOS2DX game, click the input box pop-up keyboard, interface requirements to follow the online, can not block the input box. This problem only occurs in non-full-screen keyboards to the case.
Scheme 1:mainactivity rewrite onconfigurationchanged, monitor screen orientation rotation, add android:configchanges= "Orientation|keyboard".
Disadvantage full screen invalid, if set to non-full screen, <activity android:theme= "@android: Style/theme.notitlebar.fullscreen"/>, remove fullscreen
This will display the system status bar. No, drop it!
Scenario 2: Pop-up keyboard will cause layout changes, monitoring layout changes and then calculate the offset, you can figure out whether to show or hide the keyboard.
Global keyboard display and hide does not trigger
Add layout change monitoring Root.getviewtreeobserver (). Addongloballayoutlistener (New Ongloballayoutlistener () { @Override public void Ongloballayout () { rect rect = new Rect (); Root.getwindowvisibledisplayframe (rect); int rootinvisibleheight = Root.getrootview (). GetHeight ()-Rect.bottom; if (Rootinvisibleheight <=) { //notify C + + to do what you want hidekeyboardhandler (); } else { Showkeyboardhandler (); } }
Android Monitor keyboard display and hide