This is an Air native extension that measures the soft keyboard size, because the actionscript method flash.display.Stage.softKeyboardRect():Rectangle
doesn't return a correct value in Android.
//get the height of the keyboard
var keyboardHeight:Number = MeasureKeyboard.getInstance().getKeyboardHeight() as Number;
//get the y (vertical position) of the keyboard
var keyboardY:Number = MeasureKeyboard.getInstance().getKeyboardY() as Number;
//by default, soft keyboard will push the screen upward, this method can disable it.
MeasureKeyboard.getInstance().setKeyboardAdjustNothing();
Notes:
The ANE binary (KeyboardSize.ane) is located in the bin folder. You should add it to your application project's Build Path and make sure to package it with your app.
Should you need to edit the extension source code and/or recompile it, you will find an ant build script (build.xml) in the build folder:
cd /path/to/the/ane/build
mv example.build.config build.config
#edit the build.config file to provide your machine-specific paths
ant
This ANE has been written by Lizhao Hou. It belongs to FreshPlanet Inc. and is distributed under the Apache Licence, version 2.0.