颜色估值器
ArgbEvaluator
在这个类里面有一个方法
public Object evaluate(float fraction, Object startValue, Object endValue)
解释一下参数
* @param fraction The fraction from the starting to the ending values
* @param startValue A 32-bit int value representing colors in the
* separate bytes of the parameter
* @param endValue A 32-bit int value representing colors in the
* separate bytes of the parameter
fraction :表示渐变度,取0.0F-1.0F之间某一值
startValue:表示起始颜色值
endValue:表示最终颜色值
返回的就是一个颜色值。其中的fraction是根据你的滑动而不断变化的一个值,例如ViewPager的PageTransformer里面的transformPage方法中的transformPage。
@Override
public void transformPage(View view, float position) {
// //颜色估值器
ArgbEvaluator argbEvaluator = new ArgbEvaluator();
argbEvaluator.evaluate(Math.abs(position),开始,结束);
}