键盘源码

[复制链接]
来自: chino 分类: Android精品源码 上传时间: 2016-3-23 16:24:10
Tag:键盘

项目介绍:



Software keyboard open/close watcher for Android.
Android SDK doesn't provide direct way to track open/close events from software keyboard. This small library does it for you.

Usage
Make sure that you use adjustResize windowSoftInputMode in your Acitivty configuration in AndroidManifest.xml:
[XML] 查看源文件 复制代码

Bind KeyboardWatcher in your Activity.onCreate() method. To prevent memory leaks make sure to unbind it inonDestroy() method.
[XML] 查看源文件 复制代码
public class MainActivity extends Activity implements KeyboardWatcher.OnKeyboardToggleListener {
    private KeyboardWatcher keyboardWatcher;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //...
        keyboardWatcher = KeyboardWatcher.initWith(this).bindKeyboardWatcher(this);
    }

    @Override
    protected void onDestroy() {
        keyboardWatcher.unbindKeyboardWatcher();
        super.onDestroy();
    }

    @Override
    public void onKeyboardShown(int keyboardSize) {

    }

    @Override
    public void onKeyboardClosed() {

    }
}

Download
[XML] 查看源文件 复制代码
dependencies {
  compile 'com.azimolabs.keyboardwatcher:keyboardwatcher:0.1'
}

Or if you don't want to add another dependency to your project, just copy KeyboardWatcher.java to your source directory.

相关源码推荐:

我来说两句
所有评论(53)
yunluyang 2016-3-23 16:31:49
我只是路过打酱油的。
回复
学习android 2016-3-23 17:52:10
很给力,安卓巴士有你更精彩!
回复
Harild_Whittles 2016-3-23 17:56:40
楼主用心了,内容非常精彩。
回复
apkbus热心网友 2016-3-23 18:20:22
很给力,安卓巴士有你更精彩!
回复
6433558 2016-3-23 18:21:45
感谢分享,安卓巴士有你更精彩:)
回复
yanyuxia 2016-3-25 10:02:16
强烈支持楼主ing……
回复
Ehsan78 2016-3-25 20:04:15
虽不明,但觉厉!
回复
提取码:  下载次数:16 状态:已购或VIP 售价:(原价:0)金钱 下载权限:初级码农 
3367 0 16
代码贡献英雄榜
用户名 下载数
联系我们
首页/微信公众账号投稿
帖子代码编辑/版权问题
QQ:435399051,1294855032
如何获得代码达人称号?
如何成为签约作者?
领先的中文移动开发者社区
18620764416
7*24全天服务
意见反馈:1294855032@qq.com

扫一扫关注我们

Powered by Discuz! X3.2© 2001-2019 Comsenz Inc.( 粤ICP备15117877号 )