private boolean isSoftInputMethodShowing() { DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int usableHeight = metrics.heightPixels; //这个方法获取可能不是真实屏幕的高度(可能有虚拟导航栏) //获取View可见区域的bottom Rect rect = new Rect(); getWindow().getDecorView().getWindowVisibleDisplayFrame(rect); return usableHeight - rect.bottom != 0; }
Android笔记(十):判断虚拟软键盘是否弹出
猜你喜欢
转载自blog.csdn.net/weixin_40855673/article/details/79456746
今日推荐
周排行