AndroidImageSlider
AndroidImageSlider copied to clipboard
Some slides not visible and page indicator starts with wrong position
I have used same image from R.drawable resource in all of the four slides in my slider. I am applying different transformation each time onPageSelected()
is called, to get random animations. However, sometimes slider appears blank without description. Animation and pager indicator is displayed properly in such cases.
I noticed that every time I run my app, slider shows blank slide for one particular animation. Next time I run my app, blank slide is shown for some other animation. In my case, blank slide is appearing for Foreground2Background, RotateDown, RotateUp, Stack and Tablet transformations. I am not getting any error/warning in logcat while slider is blank.
Also when animation starts, pager indicator stays at 1st position for both 0th slide and 1st slide and then it starts updating from 2nd slide. (I am using using startAutoCycle(delay,duration,autoRecover)
).
Please help me regarding this issue. Thanks in advance !
It seems that using custom indicator leads to problem. At this time, i'm using this workaround.
try {
Class<?> c = mCustomIdicator.getClass();
Field f = c.getDeclaredField("mPreviousSelectedPosition");
f.setAccessible(true);
f.setInt(mCustomIdicator, -1);
f.setAccessible(false);
} catch (Exception e) { /* ignored */ }
mSliderLayout.setCustomIndicator(mCustomIdicator);
I'd think that starting the indicator with value -1 is enough to correct the library.
any reference where this need to add code and little explanation will help how it solve the issue.