Skip to content
New issue

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

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

Already on GitHub? # to your account

关于ProgressBar的问题 #36

Open
Caij opened this issue Sep 2, 2017 · 0 comments
Open

关于ProgressBar的问题 #36

Caij opened this issue Sep 2, 2017 · 0 comments

Comments

@Caij
Copy link

Caij commented Sep 2, 2017

AppCompatProgressBarHelper.loadFromAttribute(){
TypedArray array = mView.getContext().obtainStyledAttributes(attrs, ATTR, defStyleAttr, 0);
if (array.hasValue(0)) {
mProgressTintResId = array.getResourceId(0, 0);
setSupportProgressTint(array.getColorStateList(0));
}
if (array.hasValue(1)) {
mIndeterminateTintResId = array.getResourceId(1, 0);
setSupportIndeterminateTint(array.getColorStateList(1));
}
array.recycle();
}

改成下面
AppCompatProgressBarHelper.loadFromAttribute(){
TypedArray array = mView.getContext().obtainStyledAttributes(attrs, ATTR, defStyleAttr, 0);
if (array.hasValue(0)) {
mProgressTintResId = array.getResourceId(0, 0);
setSupportProgressTint(hemeUtil.getThemeColorStateList(mProgressTintResId));
}
if (array.hasValue(1)) {
mIndeterminateTintResId = array.getResourceId(1, 0);
setSupportIndeterminateTint(ThemeUtil.getThemeColorStateList(mIndeterminateTintResId));
}
array.recycle();
}

这样可以避免replaceColor这个方法里面替换颜色 感觉这个方法太不可靠了, 只需要replaceColorById 这个里面替换颜色id就行, id替换感觉更加可靠。

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant