added in version 25.1.0
belongs to Maven artifact com.android.support:appcompat-v7:28.0.0-alpha1

SwitchCompat

public class SwitchCompat
extends CompoundButton

java.lang.Object
   ↳ android.view.View
     ↳ android.widget.TextView
       ↳ android.widget.Button
         ↳ android.widget.CompoundButton
           ↳ android.support.v7.widget.SwitchCompat


SwitchCompat is a version of the Switch widget which on devices back to API v7. It does not make any attempt to use the platform provided widget on those devices which it is available normally.

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. Similarly, the textAppearance and the related setTypeface() methods control the typeface and style of label text, whereas the switchTextAppearance and the related setSwitchTypeface() methods control that of the thumb.

See the Toggle Buttons guide.

Summary

XML attributes

SwitchCompat_android_textOff  
SwitchCompat_android_textOn  
SwitchCompat_android_thumb  
SwitchCompat_showText  
SwitchCompat_splitTrack  
SwitchCompat_switchMinWidth  
SwitchCompat_switchPadding  
SwitchCompat_switchTextAppearance  
SwitchCompat_thumbTextPadding  
SwitchCompat_thumbTint  
SwitchCompat_thumbTintMode  
SwitchCompat_track  
SwitchCompat_trackTint  
SwitchCompat_trackTintMode  

Inherited constants

From class android.widget.TextView
From class android.view.View

Inherited fields

From class android.view.View