当软键盘调起时,会重绘布局,此时当mTicksCount > 2 seekbar定位会出错
private void refreshSeekBarLocation() { initTrackLocation(); //init TickTexts Y Location if (needDrawText()) { mTextPaint.getTextBounds("j", 0, 1, mRect); mTickTextY = mPaddingTop + mCustomDrawableMaxHeight + Math.round(mRect.height() - mTextPaint.descent()) + SizeUtils.dp2px(mContext, 3); mThumbTextY = mTickTextY; } //init tick's X and text's X location; if (mTickMarksX == null) { return; } initTextsArray(); //adjust thumb auto,so find out the closest progress in the mProgressArr array and replace it. //it is not necessary to adjust thumb while count is less than 3. if (mTicksCount > 2) { mProgress = mProgressArr[getClosestIndex()]; lastProgress = mProgress; } refreshThumbCenterXByProgress(mProgress); }
@BarretWu 能都贴出页面布局,我试了一下没问题发现这个问题