SmoothCheckBox.java 文件源码

java
阅读 41 收藏 0 点赞 0 评论 0

项目:baselibrary-master 作者:
private static int getGradientColor(int startColor, int endColor, float percent)
{
    int startA = Color.alpha(startColor);
    int startR = Color.red(startColor);
    int startG = Color.green(startColor);
    int startB = Color.blue(startColor);

    int endA = Color.alpha(endColor);
    int endR = Color.red(endColor);
    int endG = Color.green(endColor);
    int endB = Color.blue(endColor);

    int currentA = (int) (startA * (1 - percent) + endA * percent);
    int currentR = (int) (startR * (1 - percent) + endR * percent);
    int currentG = (int) (startG * (1 - percent) + endG * percent);
    int currentB = (int) (startB * (1 - percent) + endB * percent);
    return Color.argb(currentA, currentR, currentG, currentB);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号