{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

BiasAlignment

public final class BiasAlignment implements Alignment


An Alignment specified by bias: for example, a bias of -1 represents alignment to the start/top, a bias of 0 will represent centering, and a bias of 1 will represent end/bottom. Any value can be specified to obtain an alignment. Inside the -1, 1 range, the obtained alignment will position the aligned size fully inside the available space, while outside the range it will the aligned size will be positioned partially or completely outside.

See also
BiasAbsoluteAlignment
Alignment

Summary

Nested types

public final class BiasAlignment.Horizontal implements Alignment.Horizontal

An Alignment.Horizontal specified by bias: for example, a bias of -1 represents alignment to the start, a bias of 0 will represent centering, and a bias of 1 will represent end.

public final class BiasAlignment.Vertical implements Alignment.Vertical

An Alignment.Vertical specified by bias: for example, a bias of -1 represents alignment to the top, a bias of 0 will represent centering, and a bias of 1 will represent bottom.

Public constructors

BiasAlignment(float horizontalBias, float verticalBias)

Public methods

@NonNull IntOffset
align(
    @NonNull IntSize size,
    @NonNull IntSize space,
    @NonNull LayoutDirection layoutDirection
)

Calculates the position of a box of size size relative to the top left corner of an area of size space.

final float
final float

Public constructors

BiasAlignment

public BiasAlignment(float horizontalBias, float verticalBias)

Public methods

align

public @NonNull IntOffset align(
    @NonNull IntSize size,
    @NonNull IntSize space,
    @NonNull LayoutDirection layoutDirection
)

Calculates the position of a box of size size relative to the top left corner of an area of size space. The returned offset can be negative or larger than space - size, meaning that the box will be positioned partially or completely outside the area.

getHorizontalBias

public final float getHorizontalBias()

getVerticalBias

public final float getVerticalBias()