An android library for outline toggle buttons
Add the following lines in your app level dependencies
dependencies {
compile 'me.rishabhkhanna:CustomToggle:1.0.0'
}
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>
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)
app:radius="0dp"
app:radius="2dp"
app:radius="20dp"
This software is licensed under the Apache License V2.0 A copy can be found here