Android development imitation IOS sliding switch implementation code
•
Android
Android development imitation IOS sliding switch implementation code
Compared with IOS, many IOS controls come with Android, and Android needs to be customized. Today, I'm talking about the sliding switch of IOS. I see that many blogs are implemented through custom togglebutton. Here, I customize the view to achieve its effect.
First, draw two semicircles and a rectangle in onsizechange.
The rest is the OnDraw method to draw the color and the switching effect.
Finally, we change his state in ontouch:
Thank you for reading, hope to help you, thank you for your support to this site!
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码