Do not play from first image.
See original GitHub issueEvery time when I enter my fragment with SliderLayout, it doesn’t start to play from first image but always from second. Does anybody encounter the same problem? I’m using the latest version of AndroidImageSlider(Version 1.1.5), Android API 14 with support library v7.
Here is my code snippet:
public class FirstFragment extends BaseFragment implements BaseSliderView.OnSliderClickListener {
......
......
private SliderLayout mSlider;
......
......
private void init(){
Map<Integer, DataBean> fileMaps = new HashMap<>();
// Here I got my data and set to fileMaps
mSlider.stopAutoCycle();
mSlider.removeAllSliders();
for (Map.Entry<Integer, DataBean> entry : fileMaps.entrySet()) {
DefaultSliderView defaultSliderView = new DefaultSliderView(mView.getContext());
defaultSliderView.bundle(new Bundle()).image(entry.getValue().getImgurl()).setOnSliderClickListener(FirstFragment.this);
defaultSliderView.getBundle().putString("ex_url", entry.getValue().getExtra_url());
defaultSliderView.setScaleType(BaseSliderView.ScaleType.CenterInside);
mSlider.addSlider(defaultSliderView);
}
mSlider.setCustomIndicator((PagerIndicator) mView.findViewById(R.id.custom_indicator));
mSlider.setDuration(5000);
mSlider.startAutoCycle();
}
And my layout xml snippet:
<RelativeLayout
android:id="@+id/linearLayout0"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.daimajia.slider.library.SliderLayout
android:id="@+id/slider"
android:layout_width="match_parent"
android:layout_height="200dp"
custom:indicator_visibility="visible"
custom:pager_animation="Default"
custom:pager_animation_span="800"/>
<com.daimajia.slider.library.Indicators.PagerIndicator
android:id="@+id/custom_indicator"
style="@style/AndroidImageSlider_Oval_Blue"
android:layout_alignBottom="@id/slider"
android:layout_marginBottom="5dp" />
</RelativeLayout>
Issue Analytics
- State:
- Created 8 years ago
- Comments:5
Top Results From Across the Web
Solved: Open Sequence opens only first image - 10077791
It should open as a video layer and be playable in the Video Timeline. What you write seem good to me. Does the...
Read more >How can I place a still image before the first frame of a video?
The exact command depends on how long you want your splash screen to be. I am pretty sure you don't want an 1-frame...
Read more >How to Play a Photo Slideshow in Windows 10 from File ...
Click on the Slide show to begin a slideshow of all of the pictures in the folder. Note that if you don't select...
Read more >Audio music file does not play past first slide...even though
Not sure why the audio file (music) added does not continue to play after the first slide transitions to the second slide.
Read more >Product video doesn't play when it is not placed first in the sort ...
Only the thumbnail image of the youtube video is visible. The video is not played if the video is not in the first...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same issue for me. When you add onPageChangeListener to your sliderShow, you can see that “onPageSelected” method from listener is called X-times (where X is slides count) for first slide (only once, after initialization) - there is probably the problem. And because onImageLoadListener seems to me not working, I’m able to “fix” it only by this hack:
Assuming that you called “sliderShow.stopAutoCycle()” (it seems AutoCycle is default ON) after you init all slides (after your forEach cycle). In case you are able to detect onImageLoad event of first slide, you don’t have to use Timer and just put code from onFinish() to “onEnd” method of OnImageLoadListener on your first slide…
EDIT:
Another approach using onImageLoadListener (works almost perfect for me):
Add “mSlider.movePrevPosition();” as below mSlider.setDuration(5000); mSlider.movePrevPosition() //show the first dot.