守望者--AIR技术交流
标题: 测量软键盘尺寸(Android+IOS) [打印本页]
作者: 破晓 时间: 2015-1-22 10:21
标题: 测量软键盘尺寸(Android+IOS)
Air Native Extension to measure soft keyboard size (Android)This is an Air native extension that measures the soft keyboard size, because the actionscript methodflash.display.Stage.softKeyboardRect():Rectangle doesn't return a correct value in Android.
Usage- //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:
- included binary has been compiled for 64-bit iOS support
InstallationThe 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.
Build scriptShould 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
复制代码 AuthorsThis ANE has been written by
Lizhao Hou. It belongs to
FreshPlanet Inc. and is distributed under the
Apache Licence, version 2.0.
[attach]564[/attach]
相关链接:
https://github.com/freshplanet/ANE-KeyboardSize
下载
| 欢迎光临 守望者--AIR技术交流 (http://www.airmyth.com/) |
|