gpt4 book ai didi

android - SeekArc 总是圆

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:21:21 26 4
gpt4 key购买 nike

我使用图书馆: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。在我的 samsung s3 和 android 4.3 seekarc 看起来不错,但在 samsung s6 和 android 5.1.1 我的 seekarc 总是显示为圆圈,没有起始角。当我将进度设置为 1 时,寻找弧线看起来正常,但是当我将角度设置为 0 时,角度消失并再次看到整个圆圈。任何想法为什么?

最佳答案

经过长时间的思考,我相信我得到了解决方案,

在您的 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();
}

关于android - SeekArc 总是圆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35732429/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com