use of net.lucode.hackware.magicindicatordemo.ext.titles.ColorFlipPagerTitleView in project MagicIndicator by hackware1993.
the class ScrollableTabExampleActivity method initMagicIndicator7.
private void initMagicIndicator7() {
MagicIndicator magicIndicator = (MagicIndicator) findViewById(R.id.magic_indicator7);
magicIndicator.setBackgroundColor(Color.parseColor("#fafafa"));
CommonNavigator commonNavigator7 = new CommonNavigator(this);
commonNavigator7.setScrollPivotX(0.65f);
commonNavigator7.setAdapter(new CommonNavigatorAdapter() {
@Override
public int getCount() {
return mDataList == null ? 0 : mDataList.size();
}
@Override
public IPagerTitleView getTitleView(Context context, final int index) {
SimplePagerTitleView simplePagerTitleView = new ColorFlipPagerTitleView(context);
simplePagerTitleView.setText(mDataList.get(index));
simplePagerTitleView.setNormalColor(Color.parseColor("#9e9e9e"));
simplePagerTitleView.setSelectedColor(Color.parseColor("#00c853"));
simplePagerTitleView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mViewPager.setCurrentItem(index);
}
});
return simplePagerTitleView;
}
@Override
public IPagerIndicator getIndicator(Context context) {
LinePagerIndicator indicator = new LinePagerIndicator(context);
indicator.setMode(LinePagerIndicator.MODE_EXACTLY);
indicator.setLineHeight(UIUtil.dip2px(context, 6));
indicator.setLineWidth(UIUtil.dip2px(context, 10));
indicator.setRoundRadius(UIUtil.dip2px(context, 3));
indicator.setStartInterpolator(new AccelerateInterpolator());
indicator.setEndInterpolator(new DecelerateInterpolator(2.0f));
indicator.setColors(Color.parseColor("#00c853"));
return indicator;
}
});
magicIndicator.setNavigator(commonNavigator7);
ViewPagerHelper.bind(magicIndicator, mViewPager);
}
Aggregations