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

calculateStatusColor() 算法问题 #290

Open
374901588 opened this issue Jun 7, 2020 · 0 comments
Open

calculateStatusColor() 算法问题 #290

374901588 opened this issue Jun 7, 2020 · 0 comments

Comments

@374901588
Copy link

private static int calculateStatusColor(@ColorInt int color, int alpha)
这个方法的算法会不会有问题? 比如我直接在 colors.xml 资源文件中定义带有透明度的值,然后通过 resource.getColor() 获取到的值,与通过 calculateStatusColor() 方法获取到的值不一样。

比如我定义了
<color name="color40">#66FF900</color> <color name="color60">#99FF900</color> <color name="color_original">#FF900</color>
通过 resource.getColor() 获取 R.color.color40 和 R.color.color60,然后分别与 calculateStatusColor(resource.getColor(R.color.color_original), 102) 和 calculateStatusColor(resource.getColor(R.color.color_original), 153) 去比较,发现对应不上。
(PS: 25540%=102, 25560%=153)

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

No branches or pull requests

1 participant