Learn togglebutton and switch of Android together
•
Android
With a simple example, this paper briefly describes the simple use of toggle button and switch in Android development, which is only for learning and sharing.
Toggle button is a button with two states (checked / unchecked). It is often used in on / off and other scenarios. The default text is displayed (on / off). Switch is a control with two states and has the effect of sliding.
(XML) source code is as follows:
About Toggle_ The selector resource file is as follows (on and off in the resource file correspond to the picture):
The source code for monitoring events is as follows:
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
二维码