iOS-SwitchView
luongvo
43
Visit GitHub RepoCheckboxes

iOS-SwitchView

A lightweight iOS switch view style for Android

Usage

Add SwitchView into xml layout

<vn.luongvo.widget.iosswitchview.SwitchView
    android:id="@+id/switchview"
    android:layout_width="50dp"
    android:layout_height="wrap_content" />

or custom properties:

<vn.luongvo.widget.iosswitchview.SwitchView
    android:id="@+id/switchview"
    android:layout_width="50dp"
    android:layout_height="wrap_content"
    app:checked="true"
    app:color_off="#e13a8e"
    app:color_on="#ef5e43" />

Add listener in activty

switchView.setOnCheckedChangeListener(new SwitchView.OnCheckedChangeListener() {
    @Override
    public void onCheckedChanged(SwitchView switchView, boolean isChecked) {
        Toast.makeText(MainActivity.this, "onCheckedChanged: " + isChecked, Toast.LENGTH_SHORT).show();
    }
});

Installation

Step 1. Add the JitPack repository to your build file

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

Step 2. Add the dependency

dependencies {
    compile 'com.github.luongvo:iOS-SwitchView:[LATEST_VERSION]'
}
Become a better Android Developer
Millions of developers are learning at MindOrks

Online Training Program

Featured Blogs

Our Team

MindOrks is Certainly one of the best online blog to stay on top of all the Android development news, coding and design patterns. Finally a blog I can count on to keep myself updated with latest and greatest things happening in Android world.

Vipul Shah
Android Developer
Microsoft

Become Pro in Android by watching videos

OUR LEARNERS WORK AT