Outline Toggle Button

Additional

Language
Java
Version
N/A
Created
Sep 24, 2017
Updated
Feb 26, 2019 (Retired)
Owner
Rishabh Khanna (Rishabhk07)
Contributors
Rishabh Khanna (Rishabhk07)
Liew Jun Tung (LiewJunTung)
2
Activity
Badge
Generate
Download
Source code

Advertisement

Custom-Toggle-Button

An android library for outline toggle buttons

How to use

Include the Library

Add the following lines in your app level dependencies

 dependencies {
        compile 'me.rishabhkhanna:CustomToggle:1.0.0'
    }

Usage

To use Custom toggle button, add the following lines in your xml

    <me.rishabhkhanna.customtogglebutton.CustomToggleButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:textOn="toggle button"
        android:textOff="toggle button"
        ></me.rishabhkhanna.customtogglebutton.CustomToggleButton>

Customizations

you can use all the default toggle button attributes and apart from that customizations can be made using following attributes: -

  • app:checkedColor="#333" (To change the color of checked toggle state)
  • app:uncheckedColor="#444" (To change the outline color of unchecked state)
  • app:borderWidth="10dp" (To change border width)
  • app:checkedTextColor="#fff" (To change text color of checked state, Default is #fff)
  • app:uncheckedTextColor="#000" (To change text color of unchecked state, Default is #333)
  • app:radius="10dp" (Define the corner radius of the button, examples given below)

Examples

  • app:radius="0dp"

  • app:radius="2dp"

  • app:radius="20dp"

License

This software is licensed under the Apache License V2.0 A copy can be found here