An Android library that lets you create an animated slider widget from your data list in a simple and fast way.
dependencies {
implementation 'com.widget.reversibleslider:+'
}
<dependency>
<groupId>com.widget</groupId>
<artifactId>reversibleslider</artifactId>
<version>1+</version>
<type>pom</type>
</dependency>
<com.widget.reversible_slider.CustomSlider
android:id="@+id/reversible_slider"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginTop="16dp" />
CustomSlider slider = findViewById(R.id.reversible_slider);
slider.setData(generateDummy());
@NotNull
private List<String> generateDummy() {
List<String> imageUrls = new ArrayList<>();
imageUrls.add("https://i0.wp.com/cdn-prod.medicalnewstoday.com/content/images/articles/325/325466/man-walking-dog.jpg?w=1155&h=1541");
imageUrls.add("https://scx2.b-cdn.net/gfx/news/hires/2019/2-nature.jpg");
imageUrls.add("https://i0.wp.com/cdn-prod.medicalnewstoday.com/content/images/articles/325/325466/man-walking-dog.jpg?w=1155&h=1541");
imageUrls.add("https://i0.wp.com/cdn-prod.medicalnewstoday.com/content/images/articles/325/325466/man-walking-dog.jpg?w=1155&h=1541");
imageUrls.add("https://www.scitecheuropa.eu/wp-content/uploads/2019/09/Nature-climate.jpg");
return imageUrls;
}
You can set your desired animation time by calling:
slider.setAnimationTime(8000); // 8000-> animation interval time in milliseconds
This project is licensed under the MIT License - see the LICENSE.md file for details
