diff --git a/bubbleseekbar/src/main/java/com/xw/repo/BubbleSeekBar.java b/bubbleseekbar/src/main/java/com/xw/repo/BubbleSeekBar.java index 8ef7b70..c434027 100644 --- a/bubbleseekbar/src/main/java/com/xw/repo/BubbleSeekBar.java +++ b/bubbleseekbar/src/main/java/com/xw/repo/BubbleSeekBar.java @@ -235,7 +235,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { setMeasuredDimension(resolveSize(getSuggestedMinimumWidth(), widthMeasureSpec), height); mLeft = getPaddingLeft() + mThumbRadiusOnDragging; - mRight = getWidth() - getPaddingRight() - mThumbRadiusOnDragging; + mRight = getMeasuredWidth() - getPaddingRight() - mThumbRadiusOnDragging; if (isShowText) { mPaint.setTextSize(mTextSize); @@ -259,7 +259,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { text = String.valueOf(mMax); mPaint.getTextBounds(text, 0, text.length(), mRectText); max = Math.max(mThumbRadiusOnDragging, mRectText.width() / 2f); - mRight = getWidth() - getPaddingRight() - max; + mRight = getMeasuredWidth() - getPaddingRight() - max; } } @@ -680,6 +680,7 @@ public int getMax() { public void setMax(int max) { mMax = max; + postInvalidate(); } public int getProgress() {