Skip to content

Button XML Attributes

J. Gabriel Gouveia edited this page Nov 3, 2017 · 10 revisions

Text Attributes

XML Attributes Default value Description
app:cb_textColor Black or white, depends of button background color Sets the button normal/enabled state text color.
app:cb_textColorPressed Black or white, depends of button background color Sets the button pressed/focused state text color.
app:cb_textColorDisabled #bdbdbd Sets the button disabled state text color.
app:cb_text Sets the button text.
app:cb_textSize 14sp Sets the text font size.
app:cb_textAllCaps false If true, sets the button text to upper case.
app:cb_textStyle normal Sets style of the button text. Normal, bold or italic.

Background Attributes

XML Attributes Default value Description
app:cb_backgroundColor #cccccc Sets the button normal/enabled state background color.
app:cb_backgroundColorPressed Background color darkned by 80% Sets the button pressed/focused state background color.
app:cb_backgroundColorDisabled #efefef Sets the button disabled state background color.
app:cb_backgroundOpacity* 1 Sets the button normal/enabled state background color transparency. A float value between 0 and 1.
app:cb_backgroundOpacityPressed* 1 Sets the button pressed/focused state background color transparency. A float value between 0 and 1.
app:cb_backgroundOpacityDisabled* 1 Sets the button disabled state background color transparency. A float value between 0 and 1.
app:cb_useRippleEffect false If true, sets ripple effect to the button background.
app:cb_rippleColor #000000 Sets the ripple effect color.
app:cb_rippleOpacity 0.26 Sets the ripple effect transparency. A float value between 0 and 1.
app:cb_elevation 0dp Sets the button elevation/shadow.
app:cb_enabled true If false, button is disabled.

Border Attributes

XML Attributes Default value Description
cb_borderColor #000000 Sets the button normal/enabled state border color.
cb_borderColorPressed Same as normal/enabled border color Sets the button pressed/focused state border color.
cb_borderColorDisabled #cccccc Sets the button disabled state border color.
cb_borderThickness 0 Sets the button normal/enabled state border size.
cb_borderThicknessPressed Same as normal/enabled border thickeness Sets the button pressed/focused state border size.
cb_borderThicknessDisabled Same as normal/enabled border thickeness Sets the button disabled state border size.
cb_borderRadius 0 Sets the button normal/enabled state border radius.
cb_borderRadiusPressed Same as normal/enabled border radius Sets the button pressed/focused state border radius.
cb_borderRadiusDisabled Same as normal/enabled border radius Sets the button disabled state border radius.

Clone this wiki locally