Cheesebaron / ViewPagerIndicator

Port of Android-ViewPagerIndicator to Xamarin.Android.
Apache License 2.0
73 stars 39 forks source link

using to indicator at the same time #9

Closed jzeferino closed 7 years ago

jzeferino commented 9 years ago

hello, im trying to use use two indicator at the same time. the circle indicator and the titleindicator.

im doing this:

_titleIndicator = view.FindViewById(Resource.Id.titleIndicator);

        _titleIndicator.FooterIndicatorStyle = TitlePageIndicator.IndicatorStyle.None;

        _titleIndicator.IsSelectedBold = false;

        _titleIndicator.SetViewPager(pager);

        _circlePageIndicator = view.FindViewById<CirclePageIndicator>(Resource.Id.circleIndicator);

        _circlePageIndicator.SetViewPager(pager);

and and i have this xml:

<viewpagerindicator.TitlePageIndicator android:id="@+id/titleIndicator" android:layout_height="wrap_content" android:layout_width="fill_parent" /> <viewpagerindicator.CirclePageIndicator android:id="@+id/circleIndicator" android:layout_below="@+id/titleIndicator" android:paddingTop="@dimen/viewpagerIndicatorPadding" android:paddingBottom="@dimen/viewpagerIndicatorPadding" android:layout_height="wrap_content" android:layout_width="fill_parent" />

<android.support.v4.view.ViewPager android:id="@+id/pager" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/circleIndicator" />

the problem is that i use both, circle and title indicator, only the circle indicator work. if i use individualy they work fine.

the problem is that the: public void SetViewPager(ViewPager view) { if (_viewPager == view) return;

        if (null != _viewPager)
            _viewPager.SetOnPageChangeListener(null);

        if (null == view.Adapter)
            throw new InvalidOperationException("ViewPager does not have an Adapter instance.");

        _viewPager = view;
        _viewPager.SetOnPageChangeListener(this);
        Invalidate();
    }

_viewPager.SetOnPageChangeListener(this); is called twice and only the last call predominate.

any workaround?