Skip to content

HamidrezaAmz/AndroidImageSlider

Repository files navigation

API Open Source Love

AndroidImageSlider

This Repo is based on daimajia's AndroidImageSlider The old repository has lots of Dependencies issues, AndroidX support, NineOldAndroid problems and was not updated in a while, so I decide to create new repo and fix them.

Demo

Usage

Add the JitPack repository to your build file, Add it in your root build.gradle at the end of repositories:

allprojects {
        repositories {
            maven { url 'https://jitpack.io' }
        }
    }

Add the dependency

Gradle

dependencies {
    implementation 'com.github.HamidrezaAmz:AndroidImageSlider:v1.0.8'
}

Step 2

Add permissions (if necessary) to your AndroidManifest.xml

<!-- if you want to load images from the internet -->
<uses-permission android:name="android.permission.INTERNET" /> 

<!-- if you want to load images from a file OR from the internet -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

Note: If you want to load images from the internet, you need both the INTERNET and READ_EXTERNAL_STORAGE permissions to allow files from the internet to be cached into local storage.

If you want to load images from drawable, then no additional permissions are necessary.

Step 3

Add the Slider to your layout:

<com.potyvideo.slider.library.SliderLayout
        android:id="@+id/slider"
        android:layout_width="match_parent"
        android:layout_height="200dp"/>

There are some default indicators. If you want to use a provided indicator:

<com.potyvideo.slider.library.Indicators.PagerIndicator
        android:id="@+id/custom_indicator"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"/>

Chage out Code example for more.

Advanced usage

Please visit Wiki

Thanks