通过根布局的 onLayoutChanage方法的bottom 和 oldbottom参数, 当布局改变时判断bottom是否大于 oldbottom参数,如果大于表示软键盘收起
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
if(v.getId() == R.id.video_view){
if(bottom != 0){
//防止聊天软键盘挤压屏幕导致视频变形
mVideoSurfaceView.setVideoDimension(mScreenWidth,mScreenHeight);
}
}else if(v.getId() == R.id.rl_live_root){
if(bottom > oldBottom){
//如果聊天窗口开启,收起软键盘时关闭聊天输入框
hideEditText();
}
}
}