Android Image Slider Library - Easy & Quick
Explore the video docs »
View Demo
.
Report Bug
.
Request Feature
Smart Slider Android is a powerful and versatile library for creating dynamic and interactive sliders in your Android applications. Whether you want to showcase images custom content, this library provides an easy-to-use solution with a wide range of customization options.
Comprehensive documentation and code examples to get you started quickly.
Step 1. Add the JitPack repository to your build file (settings.gradle)
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
...
}
}
Step 2. Add the dependency (build.gradle)
implementation 'com.github.AtikulSoftware:smart-slider:1.0'
Step 3. Add this xml code in you xml file
<androidx.viewpager2.widget.ViewPager2
android:layout_marginTop="20dp"
android:id="@+id/smartSlider"
android:layout_width="match_parent"
android:layout_height="100dp"
android:paddingStart="60dp"
android:paddingEnd="60dp"
/>
Step 4 Add this java code in you java class
ViewPager2 viewPager2 = findViewById(R.id.smartSlider);
List<SliderItem> sliderItems = new ArrayList<>();
sliderItems.add(new SliderItem(R.drawable.img1,"image 1"));
sliderItems.add(new SliderItem(R.drawable.img2,"Image 2"));
sliderItems.add(new SliderItem(R.drawable.img3,"Image 3"));
sliderItems.add(new SliderItem("https://atikulislam.xyz/images/hero.jpg","Image from url"));
viewPager2.setAdapter(new SliderAdapter(sliderItems,viewPager2,5000));
new SliderAdapter((position, title, view) -> {
Toast.makeText(this, "Position: "+position+" Title: "+title, Toast.LENGTH_SHORT).show();
});
Slider Item onClick
new SliderAdapter((position, title, view) -> {
Toast.makeText(this, "Position: "+position+" Title: "+title, Toast.LENGTH_SHORT).show();
});
Distributed under the MIT License. See LICENSE for more information.
- Md Atikul Islam - Android Software Developer - Md Atikul Islam - Easy & Quick Solution