TtSwitch
A reusable switch control according to TomTom's reference look and feel.
In case it is needed to change the thumb drawable, it is important to note that SwitchCompat has an internal constraint for the track width based on the thumb width. Namely, the minimum track width must be >= paddingLeft + 2 * thumbWidth + paddingRight
.
'showText' can be set to true
to display android:textOn
and android:textOff
on the thumb. switchTextAppearance
can be used to custom the text appearance. For example, a style contains android:textColor
can be assigned to switchTextAppearance
.
NOTE: android:textAppearance
does not work for this control. To change the text size and the font family, declares android:textSize
, android:fontFamily
directly in the style and assigns to switchTextAppearance
.
Example of how to use this control: app/src/main/res/layout/selection_controls_preview_fragment.xml
Parameters
The display context.
The attribute set provided in the layout XML file.