(The only problem with this DEMO is that the rewritten view implicitly takes the upper left origin of the screen as the reference point. I haven't found any good way to directly let this rewritten view be in the layout you need, just like the controls you usually use. Now, we temporarily use multiple nested layouts to achieve positioning, but also wait for the big cows in the world to call. This source code can repair the switch status through external buttons, or through the control itself. This document includes the following annexes:
MySlipSwitch0.2\bin\classes\com\qing\MainActivity$1.class
MySlipSwitch0.2\bin\classes\com\qing\MainActivity$2.class
MySlipSwitch0.2\bin\classes\com\qing\MainActivity.class
MySlipSwitch0.2\bin\classes\com\qing\MySlipSwitch$OnSwitchListener.class
MySlipSwitch0.2\bin\classes\com\qing\MySlipSwitch.class
MySlipSwitch0.2\bin\classes\com\qing\R$attr.class
MySlipSwitch0.2\bin\classes\com\qing\R$drawable.class
MySlipSwitch0.2\bin\classes\com\qing\R$id.class
MySlipSwitch0.2\bin\classes\com\qing\R$layout.class
MySlipSwitch0.2\bin\classes\com\qing\R$string.class
MySlipSwitch0.2\bin\classes\com\qing\R.class
MySlipSwitch0.2\bin\res\drawable-hdpi\bkg_ switch.png
MySlipSwitch0.2\bin\res\drawable-hdpi\btn_ slip.png
MySlipSwitch0.2\bin\res\drawable-hdpi\ic_ launcher.png
MySlipSwitch0.2\bin\res\drawable-ldpi\ic_ launcher.png
MySlipSwitch0.2\bin\res\drawable-mdpi\ic_ launcher.png
MySlipSwitch0.2\bin\classes.dex
MySlipSwitch0.2\bin\MySlipSwitch0.2.apk
MySlipSwitch0.2\bin\MySlipSwitch0.4.apk
MySlipSwitch0.2\bin\MySlipSwitch.apk
MySlipSwitch0.2\bin\resources.ap_
MySlipSwitch0.2\gen\com\qing\R.java
MySlipSwitch0.2\res\drawable-hdpi\bkg_ switch.png
MySlipSwitch0.2\res\drawable-hdpi\btn_ slip.png
MySlipSwitch0.2\res\drawable-hdpi\ic_ launcher.png
MySlipSwitch0.2\res\drawable-ldpi\ic_ launcher.png
MySlipSwitch0.2\res\drawable-mdpi\ic_ launcher.png
MySlipSwitch0.2\res\layout\main.xml
MySlipSwitch0.2\res\values\strings.xml
MySlipSwitch0.2\src\com\qing\MainActivity.java
..... Too many files omitted)