我使用库:https://github.com/Ross-Gibson/SeekArc。 我的情况很奇怪 这是xml中的代码:
<com.triggertrap.seekarc.SeekArc
android: id = "@+id/seekArcRestPauseTime"
android: layout_width = "match_parent"
android: layout_height = "wrap_content"
android: paddingLeft = "@dimen/fit_2BU"
android: paddingTop = "@dimen/fit_3BU"
seekarc: rotation = "180"
seekarc: startAngle = "50"
seekarc: sweepAngle = "260"
seekarc: touchInside = "true"
seekarc: arcWidth = "@dimen/fit_BU"
seekarc: progressWidth = "@dimen/fit_BU"
seekarc: enabled = "false"
seekarc: roundEdges = "true"
seekarc: arcColor = "@color/blue_heart"
seekarc: progressColor = "@color/yellow_heart" / >
你可以看到我添加了startAngle和sweepAngle。在我的三星s3与android 4.3 seekarc看起来很棒,但在三星s6与Android 5.1.1我的seekarc总是显示为圆,没有开始角度。当我在1上设置进度时,寻找正确的弧看起来,但是当我设置0个角度消失并再次看到整个circe。有什么想法吗?
答案 0 :(得分:3)
我相信经过很长一段时间的思考,我得到了解决方案,
在SeekArc文件中有一个名为
的方法private void updateProgress(int progress, boolean fromUser) {
if (progress == INVALID_PROGRESS_VALUE) {
return;
}
//This is the key area to block the looping [Starts]
if (mProgress == mMax && progress != (mProgress - 1)) {
return;
}
if (mProgress == mMin && progress != (mProgress + 1)) {
return;
}
// This is the key area to block the looping [Ends]
progress = (progress > mMax) ? mMax : progress;
progress = (progress < 0) ? 0 : progress;
mProgress = progress;
if (mOnSeekArcChangeListener != null) {
mOnSeekArcChangeListener.onProgressChanged(this, progress,
fromUser);
}
mProgressSweep = (float) progress / mMax * mSweepAngle;
updateThumbPosition();
invalidate();
}
答案 1 :(得分:0)
使用这个库,他在他的库中解决了这个bug https://github.com/lzyzsd/CircleProgress
如果没有请它会工作正常,请告诉我,我会给你编辑的版本......
希望它适合你。