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

CircleProgressView初始化的时候,设置isGraduated=true,无法改变样式 #3

Open
paihuai00 opened this issue May 4, 2018 · 3 comments
Labels
bug Something isn't working improvement

Comments

@paihuai00
Copy link

paihuai00 commented May 4, 2018

需求:想要使用作者中间镂空的圆环样式;
下载demo,看到作者是在Swicth中通过
//------代码-------
case R.id.csc_isGraduated:
if (isChecked){
//在这里改变样式
circleProgressView.setGraduatedEnabled(true);
}else {
circleProgressView.setGraduatedEnabled(false);
}
break;

但是我把 circleProgressView.setGraduatedEnabled(true); 添加到初始化的时候,样式无法改变

@Moosphan
Copy link
Owner

Moosphan commented May 4, 2018

@paihuai00 你好,的确存在问题,感谢你的使用😄,我将会在本周日之前更新一下library。如果你想要在此之前使用,可以暂时在初始化中采取如下方法:

circleProgressView.post(new Runnable() {
            @Override
            public void run() {
                circleProgressView.setGraduatedEnabled(true);
            }
        });

@paihuai00
Copy link
Author

如果解决了,还望告知原因 。辛苦作者了!

@Moosphan
Copy link
Owner

Moosphan commented May 5, 2018

@paihuai00 已经解决,请看二楼,问题原因是调用setGraduatedEnabled 方法时,view可能还没有layout完毕,通过View#post方法使其添加到队列尾部,保证了在layout结束以后才执行。

@Moosphan Moosphan added the bug Something isn't working label May 7, 2018
@Moosphan Moosphan added this to In progress in Improving Plan | Bugs Fix Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working improvement
Projects
Development

No branches or pull requests

2 participants