首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

Andoir 判断软键盘是不是弹出

2013-09-29 
Andoir 判断软键盘是否弹出前言欢迎大家我分享和推荐好用的代码段~~声明欢迎转载,但请保留文章原始出处:CS

Andoir 判断软键盘是否弹出

前言
         欢迎大家我分享和推荐好用的代码段~~
声明
         欢迎转载,但请保留文章原始出处:
         CSDN:
http://www.csdn.net
         雨季o莫忧离:http://blog.csdn.net/luckkof

正文

 

private boolean mHasInit = false;private boolean mHasKeyboard = false;private int mHeight;    @Override    protected void onLayout(boolean changed, int l, int t, int r, int b) {    // TODO Auto-generated method stub    super.onLayout(changed, l, t, r, b);    if(!mHasInit) {mHasInit = true;mHeight = b;   System.out.println("mHeight= "+b);} else {mHeight = mHeight < b ? b : mHeight;}if(mHasInit && mHeight > b) {                  //mHeight代表键盘的真实高度 ,b代表在窗口中的高度 mHeight>b mHasKeyboard = true;            Xlog.e(TAG, "bottomBar---------------->出来了");}if(mHasInit && mHasKeyboard && mHeight == b) {  // mHeight = b mHasKeyboard = false;cancelBottomBarAnimation();            this.setVisibility(View.VISIBLE);            mShowing = false;            Xlog.e(TAG, "bottomBar---------------->隐藏了");}    }


热点排行