ItemAlignmentFacet
class ItemAlignmentFacet
Optional facet provided by androidx.recyclerview.widget.RecyclerView.Adapter or androidx.recyclerview.widget.RecyclerView.ViewHolder for use in HorizontalGridView and VerticalGridView.
ItemAlignmentFacet contains single or multiple ItemAlignmentDefs. First ItemAlignmentDef describes the default alignment position for ViewHolder, it also overrides the default item alignment settings on VerticalGridView and HorizontalGridView (see setItemAlignmentOffset etc). One ItemAlignmentFacet can have multiple ItemAlignmentDefs, e.g. having two aligned positions when child1 gets focus or child2 gets focus. Grid view will visit focused view and its ancestors till the root of ViewHolder to match ItemAlignmentDefs' getItemAlignmentFocusViewId. Once a match found, the ItemAlignmentDef is used to calculate alignment position.
Summary
Nested types |
|---|
|
Definition of an alignment position under a view. |
Constants |
|
|---|---|
const Float |
Value indicates that percent is not used. |
Public constructors |
|---|
Public functions |
|
|---|---|
Array<ItemAlignmentFacet.ItemAlignmentDef!> |
Returns read only definitions of alignment positions. |
Boolean |
|
Unit |
Sets definitions of alignment positions. |
Constants
ITEM_ALIGN_OFFSET_PERCENT_DISABLED
const val ITEM_ALIGN_OFFSET_PERCENT_DISABLED = -1.0f: Float
Value indicates that percent is not used. Equivalent to 0.
Public constructors
Public functions
getAlignmentDefs
fun getAlignmentDefs(): Array<ItemAlignmentFacet.ItemAlignmentDef!>
Returns read only definitions of alignment positions.
setAlignmentDefs
fun setAlignmentDefs(defs: Array<ItemAlignmentFacet.ItemAlignmentDef!>): Unit
Sets definitions of alignment positions.