Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#fixbug 修复气泡的在滑动控件中的异常显示 #206

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions bubbleseekbar/src/main/java/com/xw/repo/BubbleSeekBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto
locatePositionInWindow();
}
}

Rect globalRect = new Rect();
/**
* In fact there two parts of the BubbleSeeBar, they are the BubbleView and the SeekBar.
* <p>
Expand All @@ -465,8 +465,10 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto
* 然后根据进度来增量计算横坐标mBubbleCenterRawX,再动态设置LayoutParameter.x,就实现了气泡跟随滑动移动。
*/
private void locatePositionInWindow() {
getLocationInWindow(mPoint);

// getLocationInWindow(mPoint);
getGlobalVisibleRect(globalRect);
mPoint[0] = globalRect.left;
mPoint[1] = globalRect.top;
ViewParent parent = getParent();
if (parent instanceof View && ((View) parent).getMeasuredWidth() > 0) {
mPoint[0] %= ((View) parent).getMeasuredWidth();
Expand Down Expand Up @@ -1006,7 +1008,7 @@ private void showBubble() {
if (mBubbleView == null || mBubbleView.getParent() != null) {
return;
}

locatePositionInWindow();
mLayoutParams.x = (int) (mBubbleCenterRawX + 0.5f);
mLayoutParams.y = (int) (mBubbleCenterRawSolidY + 0.5f);

Expand Down