TtButton
A reusable button control that implements the different visual states.
There are several different types of buttons that can be used. Changing the type changes the button's appearance, elevation, text color, background etc.
The client can also specify a Drawable if a button needs an additional drawable element.
Showing the badge on the top of the button's drawable is also possible. A typical use case could be: e.g. inform the user multiple events have happened.
All theme attributes used by this control are declared in com.tomtom.tools.android.core.theme
. To use this control, it is mandatory to define these attribute values.
Parameters
The display context.
The attribute set provided in the layout XML file.
Constructors
Constructor that is called when inflating the control from XML.
Types
The action type of a button. It affects the appearance of the button, e.g. text color, background.
Properties
The action type of the button. The appearance of the button is selected based upon the specified action type. The default type is ActionType.PRIMARY.
The color of the badge. This color is not applied for the stroke around the badge. The default value is Color.WHITE.
The tint used to modify the color of ttDrawable when ttDrawableTintMatchesTextColor is 'false'.
Showing the badge on the top of ttDrawable when set to true
. A typical use case would be: e.g. to inform the user that multiple events have happened. The default value is false
.
Functions
Overridden method because TextView's calculation of the compound left padding always includes the android:drawablePadding, even if the text itself is empty.
Overridden method because TextView's calculation of the compound right padding always includes the android:drawablePadding, even if the text itself is empty.
Set the button text from the given stringResolver.
Set ttDrawable by the given drawableResolver.