by Angads25

Angads25 / android-toggle

Custom Switches for Android

229 Stars 56 Forks Last release: about 2 years ago (v1.1.0) Apache License 2.0 47 Commits 2 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:


Android Library for Custom Switches.

Developed by

Angad Singh (@angads25)


API Build Status


Download Maven Central

Read all about internal classes and functions in the wiki.


  • Library is also Available in MavenCentral, So just put this in your app dependencies to use it:
    implementation 'com.github.angads25:toggle:1.1.0'


  1. Start by adding a Switch (eg.

    ) in your xml layout as:
  2. To the reference of Switch in your Activity/Fragment class set a Toggle Event Handler to it as below:

        LabeledSwitch labeledSwitch = findViewById(;
        labeledSwitch.setOnToggledListener(new OnToggledListener() {
            public void onSwitched(LabeledSwitch labeledSwitch, boolean isOn) {
                // Implement your switching logic here

    That's It. All your switching callbacks would be handled in

    method, parameter
    will provide the current state of the switch.

Switches Available

Labeled Switch

Day Night Switch


Copyright (C) 2018 Angad Singh

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.