GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — 修复HorizontalProgressBar单独设置进度提示气泡没跟着一起移动的bug · loosaSH/AndroidCustomView@637ebb5

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • app/src/main/java/com/allen/androidcustomview/widget
    • HorizontalProgressBar.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎app/src/main/java/com/allen/androidcustomview/widget/HorizontalProgressBar.java‎

Copy file name to clipboardExpand all lines: app/src/main/java/com/allen/androidcustomview/widget/HorizontalProgressBar.java
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ public void onAnimationUpdate(ValueAnimator valueAnimator) {
345345
moveDis = currentProgress - tipWidth / 2;
346346
}
347347
invalidate();
348+
setCurrentProgress(value);
348349
}
349350
});
350351
progressAnimator.start();
@@ -373,6 +374,15 @@ public HorizontalProgressBar setCurrentProgress(float progress) {
373374
mProgress = progress;
374375
currentProgress = progress * mWidth / 100;
375376
textString = formatNum(format2Int(progress));
377+
378+
//移动百分比提示框,只有当前进度到提示框中间位置之后开始移动,
379+
//当进度框移动到最右边的时候停止移动,但是进度条还可以继续移动
380+
//moveDis是tip框移动的距离
381+
if (currentProgress >= (tipWidth / 2) &&
382+
currentProgress <= (mWidth - tipWidth / 2)) {
383+
moveDis = currentProgress - tipWidth / 2;
384+
}
385+
376386
invalidate();
377387
return this;
378388
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.