Button.Builder
class Button.Builder : LayoutElementBuilders.LayoutElement.Builder
Builder class for Button.
Summary
Public constructors |
|---|
Creates a builder for the |
Public functions |
|
|---|---|
Button |
Constructs and returns |
Button.Builder |
Sets the colors for the |
Button.Builder |
Sets the content description for the |
Button.Builder |
Sets the custom content for this Button. |
Button.Builder |
Sets the content of this Button to be the given icon with the default size that is half of the set size of the button. |
Button.Builder |
Sets the content of this Button to be the given icon with the given size. |
Button.Builder |
Sets the content of this Button to be the given image, i.e. contacts photo. |
Button.Builder |
Sets the size for the |
Button.Builder |
Sets the size for the |
Button.Builder |
Sets the content of this Button to be the given text with the default font for the set size (for the |
Button.Builder |
Sets the content of this Button to be the given text with the given font. |
Public constructors
Builder(context: Context, clickable: ModifiersBuilders.Clickable)
Creates a builder for the Button from the given content. Custom content should be later set with one of the following (setIconContent, setTextContent, setImageContent.
| Parameters | |
|---|---|
context: Context |
The application's context. |
clickable: ModifiersBuilders.Clickable |
Associated |
Public functions
funsetButtonColors(buttonColors: ButtonColors): Button.Builder
Sets the colors for the Button. If not set, PRIMARY_COLORS will be used.
funsetContentDescription(contentDescription: CharSequence): Button.Builder
Sets the content description for the Button. It is highly recommended to provide this for button containing icon or image.
funsetCustomContent(content: LayoutElementBuilders.LayoutElement): Button.Builder
Sets the custom content for this Button. Any previously added content will be overridden.
funsetIconContent(imageResourceId: String): Button.Builder
Sets the content of this Button to be the given icon with the default size that is half of the set size of the button. Any previously added content will be overridden. Provided icon will be tinted to the given content color from ButtonColors. This icon should be image with chosen alpha channel and not an actual image.
funsetIconContent(imageResourceId: String, size: DimensionBuilders.DpProp): Button.Builder
Sets the content of this Button to be the given icon with the given size. Any previously added content will be overridden. Provided icon will be tinted to the given content color from ButtonColors and with the given size. This icon should be image with chosen alpha channel and not an actual image.
funsetImageContent(imageResourceId: String): Button.Builder
Sets the content of this Button to be the given image, i.e. contacts photo. Any previously added content will be overridden.
funsetSize(size: DimensionBuilders.DpProp): Button.Builder
Sets the size for the Button. Strongly recommended values are DEFAULT_SIZE, LARGE_SIZE and EXTRA_LARGE_SIZE. If not set, DEFAULT_SIZE will be used.
funsetSize(size: @Dimension(unit = 0) Float): Button.Builder
Sets the size for the Button. Strongly recommended values are DEFAULT_SIZE, LARGE_SIZE and EXTRA_LARGE_SIZE. If not set, DEFAULT_SIZE will be used.
funsetTextContent(text: String): Button.Builder
Sets the content of this Button to be the given text with the default font for the set size (for the DEFAULT_SIZE, LARGE_SIZE and EXTRA_LARGE_SIZE is TYPOGRAPHY_TITLE2, TYPOGRAPHY_TITLE1 and TYPOGRAPHY_DISPLAY3 respectively). Any previously added content will be overridden. Text should contain no more than 3 characters, otherwise it will overflow from the edges.
funsetTextContent(text: String, typographyName: Int): Button.Builder
Sets the content of this Button to be the given text with the given font. If you need more font related customization, consider using setCustomContent with Text component. Any previously added content will be overridden. Text should contain no more than 3 characters, otherwise it will overflow from the edges.