ItemAlignmentFacet.ItemAlignmentDef


public class ItemAlignmentFacet.ItemAlignmentDef


Definition of an alignment position under a view.

Summary

Public constructors

Public methods

final int

Returns Id of which child view take focus for alignment.

final int

Returns number of pixels to the end of low edge.

final float

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

final int

Returns Id of which child view to be aligned.

boolean

Returns true when View should be aligned to getBaseline

final boolean

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

final void
setAlignedToTextViewBaseline(boolean alignToBaseline)

When true, align to getBaseline for the view of with id equals getItemAlignmentViewId; false otherwise.

final void

Sets Id of which child view take focus for alignment.

final void

Sets number of pixels to the end of low edge.

final void

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

final void
setItemAlignmentOffsetWithPadding(boolean withPadding)

Sets whether applies padding to item alignment when getItemAlignmentOffsetPercent is 0 or 100.

final void

Sets Id of which child view to be aligned.

Public constructors

ItemAlignmentDef

Added in 1.0.0-alpha03
public ItemAlignmentDef()

Public methods

getItemAlignmentFocusViewId

Added in 1.0.0-alpha03
public final int getItemAlignmentFocusViewId()

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

getItemAlignmentOffset

Added in 1.0.0-alpha03
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
int

Number of pixels to the end of low edge.

getItemAlignmentOffsetPercent

Added in 1.0.0-alpha03
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 ITEM_ALIGN_OFFSET_PERCENT_DISABLED to disable.

getItemAlignmentViewId

Added in 1.0.0-alpha03
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 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.

isAlignedToTextViewBaseLine

Added in 1.0.0-alpha03
public boolean isAlignedToTextViewBaseLine()

Returns true when View should be aligned to getBaseline

isItemAlignmentOffsetWithPadding

Added in 1.0.0-alpha03
public final boolean isItemAlignmentOffsetWithPadding()

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

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

When false: does not apply padding

setAlignedToTextViewBaseline

Added in 1.0.0-alpha03
public final void setAlignedToTextViewBaseline(boolean alignToBaseline)

When true, align to getBaseline for the view of with id equals getItemAlignmentViewId; false otherwise.

Parameters
boolean alignToBaseline

Boolean indicating whether to align to view baseline.

setItemAlignmentFocusViewId

Added in 1.0.0-alpha03
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 getItemAlignmentViewId.

Parameters
int viewId

The id of child view that will be focused to.

setItemAlignmentOffset

Added in 1.0.0-alpha03
public final void setItemAlignmentOffset(int offset)

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

Parameters
int 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.

setItemAlignmentOffsetPercent

Added in 1.0.0-alpha03
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 ITEM_ALIGN_OFFSET_PERCENT_DISABLED to disable.

setItemAlignmentOffsetWithPadding

Added in 1.0.0-alpha03
public final void setItemAlignmentOffsetWithPadding(boolean withPadding)

Sets whether applies padding to item alignment when getItemAlignmentOffsetPercent is 0 or 100.

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

When false: does not apply padding

setItemAlignmentViewId

Added in 1.0.0-alpha03
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 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
int viewId

The id of child view that will be aligned to.