Search in sources :

Example 1 with BezierPagerIndicator

use of net.lucode.hackware.magicindicator.buildins.commonnavigator.indicators.BezierPagerIndicator in project MagicIndicator by hackware1993.

the class ScrollableTabExampleActivity method initMagicIndicator6.

private void initMagicIndicator6() {
    MagicIndicator magicIndicator = (MagicIndicator) findViewById(R.id.magic_indicator6);
    magicIndicator.setBackgroundColor(Color.WHITE);
    CommonNavigator commonNavigator = new CommonNavigator(this);
    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 ScaleTransitionPagerTitleView(context);
            simplePagerTitleView.setText(mDataList.get(index));
            simplePagerTitleView.setTextSize(18);
            simplePagerTitleView.setNormalColor(Color.GRAY);
            simplePagerTitleView.setSelectedColor(Color.BLACK);
            simplePagerTitleView.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    mViewPager.setCurrentItem(index);
                }
            });
            return simplePagerTitleView;
        }

        @Override
        public IPagerIndicator getIndicator(Context context) {
            BezierPagerIndicator indicator = new BezierPagerIndicator(context);
            indicator.setColors(Color.parseColor("#ff4a42"), Color.parseColor("#fcde64"), Color.parseColor("#73e8f4"), Color.parseColor("#76b0ff"), Color.parseColor("#c683fe"));
            return indicator;
        }
    });
    magicIndicator.setNavigator(commonNavigator);
    ViewPagerHelper.bind(magicIndicator, mViewPager);
}
Also used : Context(android.content.Context) CommonNavigator(net.lucode.hackware.magicindicator.buildins.commonnavigator.CommonNavigator) IPagerIndicator(net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerIndicator) MagicIndicator(net.lucode.hackware.magicindicator.MagicIndicator) SimplePagerTitleView(net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.SimplePagerTitleView) ScaleTransitionPagerTitleView(net.lucode.hackware.magicindicatordemo.ext.titles.ScaleTransitionPagerTitleView) ColorFlipPagerTitleView(net.lucode.hackware.magicindicatordemo.ext.titles.ColorFlipPagerTitleView) ScaleTransitionPagerTitleView(net.lucode.hackware.magicindicatordemo.ext.titles.ScaleTransitionPagerTitleView) SimplePagerTitleView(net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.SimplePagerTitleView) ClipPagerTitleView(net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ClipPagerTitleView) View(android.view.View) IPagerTitleView(net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerTitleView) ColorTransitionPagerTitleView(net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ColorTransitionPagerTitleView) BezierPagerIndicator(net.lucode.hackware.magicindicator.buildins.commonnavigator.indicators.BezierPagerIndicator) CommonNavigatorAdapter(net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.CommonNavigatorAdapter) IPagerTitleView(net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerTitleView)

Aggregations

Context (android.content.Context)1 View (android.view.View)1 MagicIndicator (net.lucode.hackware.magicindicator.MagicIndicator)1 CommonNavigator (net.lucode.hackware.magicindicator.buildins.commonnavigator.CommonNavigator)1 CommonNavigatorAdapter (net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.CommonNavigatorAdapter)1 IPagerIndicator (net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerIndicator)1 IPagerTitleView (net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerTitleView)1 BezierPagerIndicator (net.lucode.hackware.magicindicator.buildins.commonnavigator.indicators.BezierPagerIndicator)1 ClipPagerTitleView (net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ClipPagerTitleView)1 ColorTransitionPagerTitleView (net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ColorTransitionPagerTitleView)1 SimplePagerTitleView (net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.SimplePagerTitleView)1 ColorFlipPagerTitleView (net.lucode.hackware.magicindicatordemo.ext.titles.ColorFlipPagerTitleView)1 ScaleTransitionPagerTitleView (net.lucode.hackware.magicindicatordemo.ext.titles.ScaleTransitionPagerTitleView)1