Button

Added in 1.1.0
Deprecated in 1.2.0

class Button : LayoutElementBuilders.LayoutElement


Tiles component Button that represents clickable button with the given content.

The Button is circular in shape. The recommended sizes are defined in ButtonDefaults.

The recommended set of ButtonColors styles can be obtained from ButtonDefaults., e.g. PRIMARY_COLORS to get a color scheme for a primary Button.

When accessing the contents of a container for testing, note that this element can't be simply casted back to the original type, i.e.:

Button button = new Button...
Box box = new Box.Builder().addContent(button).build();

Button myButton = (Button) box.getContents().get(0);
will fail.

To be able to get Button object from any layout element, fromLayoutElement method should be used, i.e.:

Button myButton = Button.fromLayoutElement(box.getContents().get(0));

Summary

Nested types

This class is deprecated. Deprecated in Java

Public functions

java-static Button?

This function is deprecated. Deprecated in Java

ButtonColors

This function is deprecated. Deprecated in Java

ModifiersBuilders.Clickable

This function is deprecated. Deprecated in Java

CharSequence?

This function is deprecated. Deprecated in Java

LayoutElementBuilders.LayoutElement?

This function is deprecated. Deprecated in Java

String?

This function is deprecated. Deprecated in Java

String?

This function is deprecated. Deprecated in Java

DimensionBuilders.ContainerDimension

This function is deprecated. Deprecated in Java

String?

This function is deprecated. Deprecated in Java

Public functions

fromLayoutElement

Added in 1.1.0
Deprecated in 1.2.0
java-static fun fromLayoutElement(element: LayoutElementBuilders.LayoutElement): Button?

Returns Button object from the given androidx.wear.tiles.LayoutElementBuilders.LayoutElement (e.g. one retrieved from a container's content with container.getContents().get(index)) if that element can be converted to Button. Otherwise, it will return null.

getButtonColors

Added in 1.1.0
Deprecated in 1.2.0
fun getButtonColors(): ButtonColors

Returns button color of this Button.

getClickable

Added in 1.1.0
Deprecated in 1.2.0
fun getClickable(): ModifiersBuilders.Clickable

Returns click event action associated with this Button.

getContentDescription

Added in 1.1.0
Deprecated in 1.2.0
fun getContentDescription(): CharSequence?

Returns content description for this Button.

getCustomContent

Added in 1.1.0
Deprecated in 1.2.0
fun getCustomContent(): LayoutElementBuilders.LayoutElement?

Returns the custom content of this Button if it has been added. Otherwise, it returns null.

getIconContent

Added in 1.1.0
Deprecated in 1.2.0
fun getIconContent(): String?

Returns the icon content of this Button if it has been added. Otherwise, it returns null.

getImageContent

Added in 1.1.0
Deprecated in 1.2.0
fun getImageContent(): String?

Returns the image content of this Button if it has been added. Otherwise, it returns null.

getSize

Added in 1.1.0
Deprecated in 1.2.0
fun getSize(): DimensionBuilders.ContainerDimension

Returns size for this Button.

getTextContent

Added in 1.1.0
Deprecated in 1.2.0
fun getTextContent(): String?

Returns the text content of this Button if it has been added. Otherwise, it returns null.