android keybaord软键盘解决方案,监听软键盘打开关闭并实时获取高度,任意view跟随软键盘进行平移
android studio
allprojects {
repositories {
maven { url "https://dl.bintray.com/rockscy94/maven/" }
}
}
implementation 'com.rock.uicontroll:uicontroll:1.0.1'
-
注册(appliation中调用onCreate中调用)
SystemUiControll.getInstence().register(this);
-
设置任意view跟随软键盘进行平移(可传入多个view)
SystemUiControll.getInstence().setAutoMoveView(view);
-
打开关闭软键盘
-
SystemUiControll.getInstence().showOrHideKeyBoard(editText);
-
自行监听软键盘高度变化
-
SystemUiControll.getInstence().setKeyBoardListener(new KeyboardListener() { @Override public void onKeyBoardAnimStart() { Log.i(TAG, "key baord anim start"); } @Override public void onKeyBoardHeightChange(int height) { Log.i(TAG, "key baord height: " + height); } @Override public void onKeyBoardAnimEnd() { Log.i(TAG, "key baord anim end"); } });
- QQ 617913246(问题交流)