Open zhoujianhanyu opened 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); }
@w446108264 上面图
确认这是一个bug,我会尽快修复
nuddlesW 我也遇到这个问题了你的那个方法int measureHeight = measureHeight(heightMeasureSpec);
后面的那个方法是什么呢
长按后屏幕顶部出现(文字选择 - 长条ui),把头部的ui位置占用了,所以就出现输入框不见了。