hackware1993 / MagicIndicator

A powerful, customizable and extensible ViewPager indicator framework. As the best alternative of ViewPagerIndicator, TabLayout and PagerSlidingTabStrip —— 强大、可定制、易扩展的 ViewPager 指示器框架。是ViewPagerIndicator、TabLayout、PagerSlidingTabStrip的最佳替代品。支持角标,更支持在非ViewPager场景下使用(使用hide()、show()切换Fragment或使用setVisibility切换FrameLayout里的View等),http://www.jianshu.com/p/f3022211821c
9.72k stars 1.55k forks source link

onEnter onLeave #274

Open luyuan11233 opened 2 years ago

luyuan11233 commented 2 years ago

public class CommonCircleTabTitleView extends SimplePagerTitleView{ private int padding;

public CommonCircleTabTitleView(Context context) {
    super(context);
    init(context);
}

private void init(Context context) {
    padding = UIUtil.dip2px(context, 12);
    setPadding(padding, 0, padding, 0);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    lp.setMargins(UIUtil.dip2px(context, 16), 0, 0, 0);
    setLayoutParams(lp);
    setBackground(ContextCompat.getDrawable(getContext(),R.drawable.rect_shape_8_0d17171a));
}

@Override
public void onSelected(int index, int totalCount) {
    super.onSelected(index, totalCount);
}

@Override
public void onDeselected(int index, int totalCount) {
    super.onDeselected(index, totalCount);
}

@Override
public void onEnter(int index, int totalCount, float enterPercent, boolean leftToRight) {
    int color = ArgbEvaluatorHolder.eval(enterPercent, mNormalColor, mSelectedColor);
    setTextColor(color);
}

@Override
public void onLeave(int index, int totalCount, float leavePercent, boolean leftToRight) {
    int color = ArgbEvaluatorHolder.eval(leavePercent, mSelectedColor, mNormalColor);
    setTextColor(color);
}

}

103D35C905CD59BEA7646C83E9AF5C12

luyuan11233 commented 2 years ago

从全部滑动每日一币 这几个tab,来回滑,文字由黑色变成白色后会闪烁一下