Glide Slider

Additional

Language
Java
Version
1.3.2 (Aug 6, 2018)
Created
May 29, 2017
Updated
Aug 31, 2018
Owner
Maulana Firdaus (firdausmaulan)
Contributors
prokash-sarkar
JEKos
Maulana Firdaus (firdausmaulan)
mkudrnac
g00m
5
Activity
Badge
Generate
Download
Source code

Advertising

Demo

Usage

Step 1

Gradle

buildscript {

    ext.support_version = '27.1.1'
    ext.glide_version = '4.7.1'
    ext.glide_slider_version = '1.3.2'
 
 // use this config if you want to load svg
 //ext.glide_slider_version = '1.3.1'
 //ext.androidsvg_version = '1.2.1'

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven {
            url "https://jitpack.io"
        }
    }
}
dependencies {
    implementation "com.github.firdausmaulan:GlideSlider:$glide_slider_version"
}

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.glide.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.glide.slider.library.Indicators.PagerIndicator
        android:id="@+id/custom_indicator"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"/>
Add <color name="glide_slider_indicator_color">#yourhex</color> to change indicator color.

Example

Thanks