package com.android.mine.utils;
import android.content.Context;
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
import net.lucode.hackware.magicindicator.buildins.ArgbEvaluatorHolder;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.SimplePagerTitleView;
/**
* 两种颜色过渡的指示器标题
* 博客: http://hackware.lucode.net
* Created by hackware on 2016/6/26.
*/
public class BNColorTransitionPagerTitleView extends SimplePagerTitleView {
public BNColorTransitionPagerTitleView(Context context) {
super(context);
}
@Override
public void onLeave(int index, int totalCount, float leavePercent, boolean leftToRight) {
int color = ArgbEvaluatorHolder.eval(leavePercent, mSelectedColor, mNormalColor);
setTextColor(color);
}
@Override
public void onEnter(int index, int totalCount, float enterPercent, boolean leftToRight) {
int color = ArgbEvaluatorHolder.eval(enterPercent, mNormalColor, mSelectedColor);
setTextColor(color);
}
@Override
public void onSelected(int index, int totalCount) {
getPaint().setTextSize(ScreenUtil.sp2px(15));
}
@Override
public void onDeselected(int index, int totalCount) {
getPaint().setTextSize(ScreenUtil.sp2px(12));
}
}
注意,要用getPaint,不能直接setTextSize