- Include the library as local library project.
compile 'ch.ielse:switchbutton:1.0.0'
- in your layout.xml
<ch.ielse.view.SwitchView
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
3.in your activity
switchView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean isOpened = switchView.isOpened();
}
});
or
switchView.setOnStateChangedListener(new SwitchView.OnStateChangedListener() {
@Override
public void toggleToOn(SwitchView view) {
view.toggleSwitch(true); // or false
}
@Override
public void toggleToOff(SwitchView view) {
view.toggleSwitch(false); // or true
}
});
QQ Group : 274306954
##Others
hope you like my work. Star
support me a lot. thanks