监听软件盘

    @Override
    public void onGlobalLayout() {
        getWindow().getDecorView().getWindowVisibleDisplayFrame(rect);
        int screenH = SizeUtils.getScreenHeight(this);
        if (rect.bottom < screenH / 3 * 2) {
            // 软键盘打开
            historyLayout.setVisibility(View.VISIBLE);
        } else {
            // 软键盘收起
            historyLayout.setVisibility(View.GONE);
        }
    }

你可能感兴趣的:(监听软件盘)