Companion
An empty Style singleton that can be used to build a chain of style items.
This is a bit of a trick that lets us make Style.background()
look like a static call, but actually be a member call since Style
is now a singleton object. Otherwise we'd need to define both a static Style.background()
and a member function to support Style.padding(...).background()
.
Functions
Whether the view is a heading for a section of content for accessibility purposes.
The Android Talkback "role" this component has. This will be read out when the view is visited in Talkback mode. See AccessibilityRoleType for possible roles.
The description for this Component's accessibilityRole. This will be read out when the view is visited in Talkback mode.
Excludes a rectangle within the local bounds from the system gesture. After layout, []exclusion] is called to determine the Rect to exclude from the system gesture area.
Defines an aspect ratio for this component, meaning the ratio of width to height. This means if aspectRatio is set to 2 and width is calculated to be 50px, then height will be 100px.
Sets a background on the View this Component mounts to. Setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Sets ColorDrawable of the given color as a background on the View this Component mounts to. Setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Setting this to false allows child views of this view to draw outside its bounds, overriding the default behavior. It only applies to direct children. Setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Sets whether the View's Outline should be used to clip the contents of the View. Setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Sets the container title for app-developer-defined container which can be any type of ViewGroup or layout. Container title will be used to group together related controls, similar to HTML fieldset.
A description of the contents of this Component for accessibility.
Sets whether this ViewGroup's drawable states also include its children's drawable states. This is used, for example, to make a group appear to be focused when its child EditText or button is focused. Setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Sets whether the View gets its drawable state (focused, pressed, etc.) from its direct parent rather than from itself. Setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Sets a foreground on the View this Component mounts to. Setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Sets ColorDrawable of the given color as a background on the View this Component mounts to. Setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Sets a specific preferred percent height for this component when its parent lays it out.
Sets whether this Component is "important for accessibility". If it is, it fires accessibility events and is reported to accessibility services that query the screen. The value for this property can be one of the values in ImportantForAccessibility.
Setting this property will cause the Component to be a keyboard navigation cluster. Setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Specifies the type of layer backing this view. The layer can be LayerType.LAYER_TYPE_NOT_SET, LayerType.LAYER_TYPE_NONE, LayerType.LAYER_TYPE_SOFTWARE or LayerType.LAYER_TYPE_HARDWARE.
Describes the RTL/LTR direction of component. Determines whether {@link YogaEdge#START} and {@link YogaEdge#END} will resolve to the left or right side, among other things. INHERIT indicates this setting will be inherited from this component's parent. Setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Sets the live region mode for this view. This indicates to accessibility services whether they should automatically notify the user about changes to the view's content description or text, or to the content descriptions or text of the view's children (where applicable).
Sets margin value for specified edge to auto. The item will extend the margin for this edge to occupy the extra space in the parent, depending on the direction (Row or Column).
Defines margin around the component on a per-edge basis, with a percent value of container's size. See https://www.yogalayout.dev/docs/styling/margin-padding-border for more information.
Sets a specific maximum percent height for this component when its parent lays it out.
Sets a specific maximum percent width for this component when its parent lays it out.
Sets the minimum time duration between two content change events, which is used in throttling content change events in accessibility services.
Sets a specific minimum percent height for this component when its parent lays it out.
Sets a specific minimum percent width for this component when its parent lays it out.
This Style adds a mount callbacks. The BindFunc is invoked when the Component is mounted, and it receives a BindScope and the content this Component rendered to which can be a View or Drawable. The BindFunc must return an UnbindFunc and it must undo any mutations made to the View in the BindFunc. This API can be used to create higher-order Styles.
Note: Please use onBindViewWithDescription instead.
This Style adds a mount callbacks. The BindFunc is invoked when the Component is mounted, and it receives a BindScope and the content this Component rendered to which can be a View or Drawable. The BindFunc must return an UnbindFunc and it must undo any mutations made to the View in the BindFunc. This API can be used to create higher-order Styles.
Sets a listener that will invoke the given lambda when this Component is clicked. Setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Sets a listener that will invoke the given lambda when this Component is clicked but only if enabled is true. If enabled, setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Sets a listener that will invoke the given lambda when this Component's focus changes. Setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Sets a listener that will invoke the given lambda when this Component's focus changes but only if enabled is true. If enabled, setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Registers a callback to be called when either the Component occupies at least half of the viewport, or, if the Component is smaller than half the viewport, when it is fully visible.
Registers a callback to be called when all parts of a Component have been made visible at some point, termed a "full impression". A full impression is defined as:
Initializes an AccessibilityEvent with information about the the host View which dispatched the event.
Initializes an AccessibilityNodeInfoCompat with information about the host view.
Sets a listener that will intercept all touch screen motion events. This allows you to watch events as they are dispatched to your children, and take ownership of the current gesture at any point. Implementations should return true if they intercepted the event and wish to receive subsequent events, and false otherwise. Setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Sets a listener that will intercept all touch screen motion events but only if enabled is true. This allows you to watch events as they are dispatched to your children, and take ownership of the current gesture at any point. Implementations should return true if they intercepted the event and wish to receive subsequent events, and false otherwise. If enabled is true, setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Registers a callback to be called when a Component becomes fully invisible (e.g. scrolled off or unmounted)
Sets a listener that will invoke the given lambda when this Component is long clicked. Setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Sets a listener that will invoke the given lambda when this Component is long clicked but only if enabled is true. If enabled, setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Called when performs the specified accessibility action on the view.
Performs the specified accessibility action on a virtual view child of the host View and gives an opportunity to the parent (the host) to implement the desired behavior.
Gives a chance to the host View to populate the accessibility event with its text content.
Gives a chance to the component to implement its own accessibility support.
Called when a child of the host View has requested sending an AccessibilityEvent and gives an opportunity to the parent (the host) to augment the event.
Called when Sends an accessibility event of the given type. If accessibility is not enabled this method has no effect.
Sends an accessibility event. This method behaves exactly as sendAccessibilityEvent() but takes as an argument an empty AccessibilityEvent and does not perform a check whether accessibility is enabled.
Sets a listener that will invoke the given lambda when this Component is touched. Setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Sets a listener that will invoke the given lambda when this Component is touched but only if enabled is true. If enabled, setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Registers a callback to be called when the Component is no longer focused, i.e. it is not fully visible and does not occupy at least half the viewport.
Called when a virtual view child of the host View has changed keyboard focus and gives an opportunity to the parent (the host) to react (changing visual display, etc.)
Registers a callback to be called when the visible rect of a Component changes.
Sets a ViewOutlineProvider on the View this Component mounts to. Setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Defines padding on the component on a per-edge basis, with a percent value of container's size. See https://www.yogalayout.dev/docs/styling/margin-padding-border for more information.
Visually distinct portion of a window with window-like semantics are considered panes for accessibility purposes. One example is the content view of a large fragment that is replaced. In order for accessibility services to understand a pane's window-like behavior, panes should have descriptive titles. Views with pane titles produce AccessibilityEvent#TYPE_WINDOW_STATE_CHANGEDs when they appear, disappear, or change title.
Sets the transform pivot of a View (used for scale and rotation transforms) to be centered at the given percentages of the View's width and height. The default pivot point is (50f, 50f).
Used in conjunction with positionType to define how a component should be positioned in its parent.
Used in conjunction with positionType to define how a component should be positioned in its parent, with a float value between 0 and 100.
See docs in position.
Style prop that provides FirstDrawReporter to report the first draw after isContentReady is first set to true
.
Sets whether the node has requested initial accessibility focus.
Sets the degree that this component is rotated around the pivot point. Increasing the value results in clockwise rotation. By default, the pivot point is centered on the component. Setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Sets the degree that this component is rotated around the horizontal axis through the pivot point. Setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Sets the degree that this component is rotated around the vertical axis through the pivot point. Setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Sets the scale (scaleX and scaleY) on this component. This is mostly relevant for animations and being able to animate size changes. Otherwise for non-animation usecases, you should use the standard layout properties to control the size of your component. Setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Sets whether this View should be a focusable element for screen readers
Style for attaching a standard Material Design shadow to a component. Refer to https://material.io/design/environment/light-shadows.html for more information.
Sets the state description of the component associated to this Style.
Attaches the provided StateListAnimator to this Component. Setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Sets the tooltip text which will be displayed in a small popup next to the view.
Defines touch Expansion area around the component on a per-edge basis.
Sets transition key and Transition.TransitionKeyType on the View this Component mounts to. Setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
Sets Activity transition name on the View this Component mounts to. Setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.
An overload of Style.viewBinder which takes a RenderUnit.Binder that does not require a model.
Defines the visibility of the Component. The values can be Visibility.VISIBLE or Visibility.INVISIBLE. The default value Visibility.VISIBLE which means is the same as View.VISIBLE; i.e. the component will be invisible but still occupy space. Note: Using this API will not change how Visibility Events are dispatched; onVisible and/or onInvisible will work as if this property was not in use.
Defines a ratio of the Component height for the visibility callback to be dispatched use together with onVisible and/or with onInvisible.
Defines a ratio of the Component width for the visibility callback to be dispatched use together with onVisible and/or with onInvisible.
Sets a specific preferred percent width for this component when its parent lays it out.
Specifies that this Component should be represented as a View when this hierarchy is mounted.