Custom Android switch track 'animation'

后端 未结 3 860
小蘑菇
小蘑菇 2021-02-15 13:52

I\'ve created a basic custom Switch, as defined below.



        
3条回答
  •  情话喂你
    2021-02-15 13:54

    A Switch is a two-state toggle switch widget that can select between two options. The user may drag the "thumb" back and forth to choose the selected option, or simply tap to toggle as if it were a checkbox. The text property controls the text displayed in the label for the switch, whereas the off and on text controls the text on the thumb .

    For this requirement you need to customize your Switch Button Functionality

    You can visit for demo

    1. Slide Toggle for Android

    2. Android-Switch-Demo-pre-4.0

    3. Custom Toggle Button for Android Applications

    You need to understand below two lines .

            android:thumb="@drawable/customswitchselector"
            android:track="@drawable/custom_track"
    

    It has two tag: android:thumb and android:track.Thumb will draw the actual look when we swipe or change the status .

提交回复
热议问题