w446108264 / XhsEmoticonsKeyboard

android emoticonsKeyboard support emoji and user-defined emoticon. easy to integrated into your project
2.85k stars 597 forks source link

长按输入框会出现输入框沉到底部(google 原生系统) #37

Open zhoujianhanyu opened 8 years ago

zhoujianhanyu commented 8 years ago

长按后屏幕顶部出现(文字选择 - 长条ui),把头部的ui位置占用了,所以就出现输入框不见了。

w446108264 commented 8 years ago

有截图吗

nuddlesW commented 8 years ago

全屏模式下把AutoHeighView里的onMeasure方法改成这样,可以修复这个问题,mActionBar就是获取actionBar的高度即可

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    //核心方法,这里传入maxParentHeight来太到拉起键盘不挤压布局,同时在拉起键盘的同时,把底部view的高度设成和键盘高度一至,达到好像是键盘挤压了布局的效果
    int measureHeight = measureHeight(heightMeasureSpec);
    Log.d(TAG, "onMeasure" + measureHeight);
    if (measureHeight == (mMaxParentHeight  - mActionBarHeight)) {
        //此情况下是复制弹出actionbar,修复复制时会挤压的问题
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        return;
    }

    if (mMaxParentHeight != 0 ) {
        int heightMode = MeasureSpec.getMode(heightMeasureSpec);
        int expandSpec = MeasureSpec.makeMeasureSpec(mMaxParentHeight, heightMode);
        super.onMeasure(widthMeasureSpec, expandSpec);
        return;
    }
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}

非全屏

@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { //核心方法,这里传入maxParentHeight来太到拉起键盘不挤压布局,同时在拉起键盘的同时,把底部view的高度设成和键盘高度一至,达到好像是键盘挤压了布局的效果 int measureHeight = measureHeight(heightMeasureSpec); Log.d(TAG, "onMeasure" + measureHeight); if (measureHeight == (mMaxParentHeight - mSoftKeyboardHeight - mActionBarHeight)) {//此情况下是复制弹出actionbar int heightMode = MeasureSpec.getMode(heightMeasureSpec); int expandSpec = MeasureSpec.makeMeasureSpec(mMaxParentHeight - mActionBarHeight, heightMode); super.onMeasure(widthMeasureSpec, expandSpec); return; } if (mMaxParentHeight != 0 ) { int heightMode = MeasureSpec.getMode(heightMeasureSpec); int expandSpec = MeasureSpec.makeMeasureSpec(mMaxParentHeight, heightMode); super.onMeasure(widthMeasureSpec, expandSpec); return; } super.onMeasure(widthMeasureSpec, heightMeasureSpec); }

zhoujianhanyu commented 8 years ago

device-2016-10-11-213340

zhoujianhanyu commented 8 years ago

@w446108264 上面图

w446108264 commented 8 years ago

确认这是一个bug,我会尽快修复

ybADMIN commented 7 years ago

nuddlesW 我也遇到这个问题了你的那个方法int measureHeight = measureHeight(heightMeasureSpec); 后面的那个方法是什么呢