zhpanvip/viewpagerindicator

The default status of indicator is not correct

JimLyu opened this issue · 6 comments

Hello, I use the option like this: (Java)

    IndicatorOptions options = new IndicatorOptions();
    options.setIndicatorStyle(IndicatorStyle.CIRCLE);
    options.setSlideMode(IndicatorSlideMode.WORM); 
    options.setSliderColor(Color.CYAN, Color.BLUE);
    options.setSliderWidth(36, 36);
    indicator.setIndicatorOptions(options);

The color of first circle (default position is 0) would be Cyan (normalColor) until I slid it. And I found out that only I set IndicatorSlideMode.NORMAL, it would be the correct color. How should I do if I want to make the first circle in "checkedColor" in the beginning when the view shows?

Thank you

Don't use IndicatorOptions to set the parameters for indicator, you just do like the Code on the REDMINE

indicatorView.setSliderColor(normalColor, checkedColor)
                    .setSliderWidth(resources.getDimension(R.dimen.dp_10))
                    .setSliderHeight(resources.getDimension(R.dimen.dp_5))
                    .setSlideMode(IndicatorSlideMode.WORM)
                    .setIndicatorStyle(IndicatorStyle.CIRCLE)
                    .setupWithViewPager(view_pager2)
               

Thanks for answer, but by this way, it still didn't show any activated circle in the beginning.

It's something wrong with you code in your project? You can check it. Or you can copy the following code to your project:

val options = IndicatorOptions()
        options.indicatorStyle = IndicatorStyle.CIRCLE
        options.slideMode = IndicatorSlideMode.WORM
        options.setSliderColor(Color.CYAN, Color.BLUE)
        options.setSliderWidth(36f, 36f)
        indicatorView.setIndicatorOptions(options)
        indicatorView.setupWithViewPager(view_pager2)

I have test this code,It works well.

Thanks a lot!
I finally succeeded while I changed the "ViewPager" to "ViewPager2" and made the adapter it required.

So weird,I also test with ViewPager,It's nothing problem.

Oh! I'm so sorry,I think this is a bug in version 1.0.6,and it was coincidentally fixed by recently commits,but The latest code has not been released.
I will be release a new version soon.