parkingwang / vehicle-keyboard-android

停车王车牌键盘-Android
Other
658 stars 148 forks source link

系统键盘同时出现 #7

Closed huangjide closed 6 years ago

huangjide commented 6 years ago

如果页面还有其他输入框让系统软键盘弹出来,那么这个键盘和系统键盘会同时上下显示出来,如何控制比较好呢?

chenxxpro commented 6 years ago

在点击车牌输入框时显示,输入完成后隐藏。

YXHTom commented 6 years ago

其他输入框还没有完全隐藏,这个键盘就出来了导致显示位置错乱,有什么建议吗

YXHTom commented 6 years ago

1521707605919

msdx commented 6 years ago

@YXHTom 你是使用哪种方式弹出键盘的?

YXHTom commented 6 years ago

edittext输入完成后隐藏系统输入框,后开启车牌输入框;系统输入框还没完全消失,车牌输入框就开始显示

msdx commented 6 years ago

@YXHTom 是使用PopupWindow来弹键盘的吗?

YXHTom commented 6 years ago

点击输入框自动单出来的键盘

msdx commented 6 years ago

这里采用的是把键盘添加到一个 FrameLayout 再把 FrameLayout 添加到 decorView 的方式。忽略下面内容的解决方式。

@yoojia 抽时间更新一下。 https://github.com/parkingwang/vehicle-keyboard-android/tree/724a63b880e694bb435f4e07ed0c03410ecedaf1/keyboard/src/main/java/com/parkingwang/vehiclekeyboard/support/PopupHelper.java ,这个文件 69 行需要的 bottom 值计算需要改一下,如果 windowSoftInputMode 值为 adjustPanadjustNothing 则为0。

public enum AdjustInputMode {
    PAN {
        @Override
        public int calcOffsetY(View decorView) {
            return 0;
        }
    },
    RESIZE,
    NOTHING {
        @Override
        public int calcOffsetY(View decorView) {
            return 0;
        }
    },
    UNSPECIFIED;

    public int calcOffsetY(View decorView) {
        final Rect rect = new Rect();
        decorView.getWindowVisibleDisplayFrame(rect);
        return decorView.getHeight() - rect.bottom;
    }
}
as11051105 commented 6 years ago

这个问题还没有改么?

msdx commented 6 years ago

@yoojia 请 review 一下 PR。