use of net.lucode.hackware.magicindicator.buildins.commonnavigator.indicators.WrapPagerIndicator in project MagicIndicator by hackware1993.
the class ScrollableTabExampleActivity method initMagicIndicator8.
private void initMagicIndicator8() {
MagicIndicator magicIndicator = (MagicIndicator) findViewById(R.id.magic_indicator8);
magicIndicator.setBackgroundColor(Color.WHITE);
CommonNavigator commonNavigator = new CommonNavigator(this);
commonNavigator.setScrollPivotX(0.35f);
commonNavigator.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 SimplePagerTitleView(context);
simplePagerTitleView.setText(mDataList.get(index));
simplePagerTitleView.setNormalColor(Color.parseColor("#333333"));
simplePagerTitleView.setSelectedColor(Color.parseColor("#e94220"));
simplePagerTitleView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mViewPager.setCurrentItem(index);
}
});
return simplePagerTitleView;
}
@Override
public IPagerIndicator getIndicator(Context context) {
WrapPagerIndicator indicator = new WrapPagerIndicator(context);
indicator.setFillColor(Color.parseColor("#ebe4e3"));
return indicator;
}
});
magicIndicator.setNavigator(commonNavigator);
ViewPagerHelper.bind(magicIndicator, mViewPager);
}
Aggregations