Skip to content

aparimit03/image-carousel-kotlin

Repository files navigation

Glyd 📸 - Image Carousel Kotlin Library

A lightweight, customizable image carousel library for Android built with Kotlin and Jetpack. Perfect for showcasing image sliders, banners, or galleries in your app with minimal setup.

🚀 Features

  • 📷 Load images via Picasso or Glide
  • 🔁 Infinite scroll support
  • ⚡ Smooth swiping & auto-scroll
  • 🎯 Click listener support
  • 🧩 Easy to plug into any layout

🛠 Installation

Step 1: Add JitPack to your project's settings.gradle or build.gradle.kts

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven { url = uri("https://jitpack.io") }
    }
}

Step 2: Add the dependency to your module’s build.gradle.kts

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven { url = uri("https://jitpack.io") }
    }
}

Step 3: Define the view in the XML file

<com.example.carousel.CarouselView
    android:id="@+id/carouselView"
        android:layout_width="wrap_content"
        android:layout_height="250dp"
        app:auto_cycle="true"
        android:gravity="center"
        app:corner_radius="20"
        app:placeholder="@drawable/placeholder"
        app:error_image="@drawable/error"
        app:selected_dot="@drawable/default_selected_dot"
        app:unselected_dot="@drawable/default_unselected_dot"
        app:period="3000"
        app:delay="5"/>

Step 4: Write the Kotlin code

val carouselView = findViewById<CarouselView>(R.id.carouselView)

val imageUrls = listOf(
    "https://example.com/image1.jpg",
    "https://example.com/image2.jpg",
    "https://example.com/image3.jpg"
)

carouselView.setImageUrls(imageUrls)
carouselView.setAutoScroll(true)
carouselView.setScrollInterval(3000) // optional: 3 seconds

Support

If you like this project, give it a ⭐ on GitHub!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages