Popularity
1.2
Stable
Activity
0.0
Stable
22
1
5

Programming language: Kotlin
Tags: Animations     Switch     Android-library    
Latest version: v1.0.1

RevealSwitch alternatives and similar packages

Based on the "Animations" category.
Alternatively, view RevealSwitch alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of RevealSwitch or a related project?

Add another 'Animations' Package

README

RevealSwitch

Android Arsenal

This library provides you cool reveal animation on toggle.

g_20181001_0205015

Dependency

Step 1: Add Jitpack repository to your root(project) build.gradle at the end of repositories.

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

Step 2: Add gradle dependency to your module's build.gradle.

 dependencies {
   implementation 'com.github.Akashkamble:RevealSwitch:1.0.1'
}

Usage

Add RevealSwitch to your layout like file like this

<com.akash.RevealSwitch
  android:id="@+id/revealSwitch"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  .../>

To add the toggleListener add following code

switch.setToggleListener(object : OnToggleListener{
    override fun onToggle(isEnable: Boolean) {
       Log.e("TAG","isEnabled ? $isEnable")
    }
 })

To change color of enabled track (default color #444444)

screenshot_20181001-013416-02

Add this in xml

app:setEnabledTrackColor="#FF1744"

Add this in Kotlin or Java

 switch.setEnabledTrackColor(Color.parseColor("#FF1744"))

To changle color of disabled track (default colot #FFFFFF)

screenshot_20181001-014628-01

Add this in xml

app:setDisabledTrackColor="#FFFFFF"

Add this in Kotlin or Java

 switch.setDisabledTrackColor(Color.parseColor("#FFFFFF"))

To add the animation duration (default 500ms)

Add this line in xml

app:setAnimationDuration="700"

Add this in Kotlin or Java

switch.setAnimationDuration(700) //Accepts value between 500ms to 1500ms

Added in version 1.0.1

To show the border (default false)

Add this line in your layout file.

app:showBorder="true"

Default border color will be thumb color.

To set borer color

Add this line in xml

app:borderColor="#FF1744"