In the below code first I have added a Switch button in main layout. Here I have created two-state toggle switch that can select between two options. The user may drag the thumb back and forth to choose the selected option. In MainActivity I have used onCheckedChanged method and toast function. See the below code it will clearly described how to make On/Off switch button .
0 Comment(s)