public class

ItemAlignmentFacet.ItemAlignmentDef

extends java.lang.Object

 java.lang.Object

↳androidx.leanback.widget.ItemAlignmentFacet.ItemAlignmentDef

Overview

Definition of an alignment position under a view.

Summary

Constructors
publicItemAlignmentDef()

Methods
public final intgetItemAlignmentFocusViewId()

Returns Id of which child view take focus for alignment.

public final intgetItemAlignmentOffset()

Returns number of pixels to the end of low edge.

public final floatgetItemAlignmentOffsetPercent()

Gets the offset percent for item alignment in addition to offset.

public final intgetItemAlignmentViewId()

Returns Id of which child view to be aligned.

public booleanisAlignedToTextViewBaseLine()

Returns true when View should be aligned to View

public final booleanisItemAlignmentOffsetWithPadding()

Returns true if applies padding to item alignment when ItemAlignmentFacet.ItemAlignmentDef.getItemAlignmentOffsetPercent() is 0 or 100; returns false otherwise.

public final voidsetAlignedToTextViewBaseline(boolean alignToBaseline)

When true, align to View for the view of with id equals ItemAlignmentFacet.ItemAlignmentDef.getItemAlignmentViewId(); false otherwise.

public final voidsetItemAlignmentFocusViewId(int viewId)

Sets Id of which child view take focus for alignment.

public final voidsetItemAlignmentOffset(int offset)

Sets number of pixels to the end of low edge.

public final voidsetItemAlignmentOffsetPercent(float percent)

Sets the offset percent for item alignment in addition to offset.

public final voidsetItemAlignmentOffsetWithPadding(boolean withPadding)

Sets whether applies padding to item alignment when ItemAlignmentFacet.ItemAlignmentDef.getItemAlignmentOffsetPercent() is 0 or 100.

public final voidsetItemAlignmentViewId(int viewId)

Sets Id of which child view to be aligned.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public ItemAlignmentDef()

Methods

public final void setItemAlignmentOffset(int offset)

Sets number of pixels to the end of low edge. Supports right to left layout direction.

Parameters:

offset: In left to right or vertical case, it's the offset added to left/top edge. In right to left case, it's the offset subtracted from right edge.

public final int getItemAlignmentOffset()

Returns number of pixels to the end of low edge. Supports right to left layout direction. In left to right or vertical case, it's the offset added to left/top edge. In right to left case, it's the offset subtracted from right edge.

Returns:

Number of pixels to the end of low edge.

public final void setItemAlignmentOffsetWithPadding(boolean withPadding)

Sets whether applies padding to item alignment when ItemAlignmentFacet.ItemAlignmentDef.getItemAlignmentOffsetPercent() is 0 or 100.

When true: Applies start/top padding if ItemAlignmentFacet.ItemAlignmentDef.getItemAlignmentOffsetPercent() is 0. Applies end/bottom padding if ItemAlignmentFacet.ItemAlignmentDef.getItemAlignmentOffsetPercent() is 100. Does not apply padding if ItemAlignmentFacet.ItemAlignmentDef.getItemAlignmentOffsetPercent() is neither 0 nor 100.

When false: does not apply padding

public final boolean isItemAlignmentOffsetWithPadding()

Returns true if applies padding to item alignment when ItemAlignmentFacet.ItemAlignmentDef.getItemAlignmentOffsetPercent() is 0 or 100; returns false otherwise.

When true: Applies start/top padding when ItemAlignmentFacet.ItemAlignmentDef.getItemAlignmentOffsetPercent() is 0. Applies end/bottom padding when ItemAlignmentFacet.ItemAlignmentDef.getItemAlignmentOffsetPercent() is 100. Does not apply padding if ItemAlignmentFacet.ItemAlignmentDef.getItemAlignmentOffsetPercent() is neither 0 nor 100.

When false: does not apply padding

public final void setItemAlignmentOffsetPercent(float percent)

Sets the offset percent for item alignment in addition to offset. E.g., 40 means 40% of width/height from the low edge. In the right to left case, it's the 40% width from right edge. Use ItemAlignmentFacet.ITEM_ALIGN_OFFSET_PERCENT_DISABLED to disable.

public final float getItemAlignmentOffsetPercent()

Gets the offset percent for item alignment in addition to offset. E.g., 40 means 40% of the width from the low edge. In the right to left case, it's the 40% from right edge. Use ItemAlignmentFacet.ITEM_ALIGN_OFFSET_PERCENT_DISABLED to disable.

public final void setItemAlignmentViewId(int viewId)

Sets Id of which child view to be aligned. View.NO_ID refers to root view and should be only used in first one. Different view ids of #getAlignmentDefs() define multiple alignment steps within one itemView, e.g. there are two child views R.id.child1 and R.id.child2. App may allocated two ItemAlignmentFacet.ItemAlignmentDefs, one with view id R.id.child1, the other with view id R.id.child2. Note this id may or may not be same as the child view that takes focus.

Parameters:

viewId: The id of child view that will be aligned to.

See also: ItemAlignmentFacet.ItemAlignmentDef.setItemAlignmentFocusViewId(int)

public final int getItemAlignmentViewId()

Returns Id of which child view to be aligned. View.NO_ID refers to root view and should be only used in first one. Different view ids of #getAlignmentDefs() define multiple alignment steps within one itemView, e.g. there are two child views R.id.child1 and R.id.child2. App may allocated two ItemAlignmentFacet.ItemAlignmentDefs, one with view id R.id.child1, the other with view id R.id.child2. Note this id may or may not be same as the child view that takes focus.

See also: ItemAlignmentFacet.ItemAlignmentDef.setItemAlignmentFocusViewId(int)

public final void setItemAlignmentFocusViewId(int viewId)

Sets Id of which child view take focus for alignment. When not set, it will use use same id of ItemAlignmentFacet.ItemAlignmentDef.getItemAlignmentViewId().

Parameters:

viewId: The id of child view that will be focused to.

public final int getItemAlignmentFocusViewId()

Returns Id of which child view take focus for alignment. When not set, it will use use same id of ItemAlignmentFacet.ItemAlignmentDef.getItemAlignmentViewId()

public final void setAlignedToTextViewBaseline(boolean alignToBaseline)

When true, align to View for the view of with id equals ItemAlignmentFacet.ItemAlignmentDef.getItemAlignmentViewId(); false otherwise.

Parameters:

alignToBaseline: Boolean indicating whether to align to view baseline.

public boolean isAlignedToTextViewBaseLine()

Returns true when View should be aligned to View