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.
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
dependencies {
implementation 'com.github.HamidrezaAmz:AndroidImageSlider:v1.0.8'
}
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.
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.
Please visit Wiki