WatchDetailActivity.java 文件源码

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

项目:ViewPagerZoomTransformer 作者:
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
    this.position = position;
    ArgbEvaluator evaluator = new ArgbEvaluator(); // ARGB求值器
    int evaluate = colors[0]; // 初始默认颜色(透明白)
    int startColor =  colors[this.position <= 0 ? 0 : position];
    int endColor;
    if (position == 0){
        endColor = colors[position +1];
    }else {
        endColor = colors[position +1 >=colors.length ? colors.length -1 : position +1];
    }

    evaluate = (Integer) evaluator.evaluate(positionOffset, startColor, endColor); // 根据positionOffset和第0页~第1页的颜色转换范围取颜色值
    mViewRoot.setBackgroundColor(evaluate);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getWindow().setStatusBarColor(evaluate);
    }

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号