java.lang.Object | |
↳ | android.support.v7.widget.OrientationHelper |
Helper class for LayoutManagers to abstract measurements depending on the View's orientation.
It is developed to easily support vertical and horizontal orientations in a LayoutManager but can also be used to abstract calls around view bounds and child measurements with margins and decorations.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | HORIZONTAL | ||||||||||
int | VERTICAL |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
mLayoutManager |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a horizontal OrientationHelper for the given LayoutManager.
| |||||||||||
Creates an OrientationHelper for the given LayoutManager and orientation.
| |||||||||||
Creates a vertical OrientationHelper for the given LayoutManager.
| |||||||||||
Returns the end of the view including its decoration and margin.
| |||||||||||
Returns the space occupied by this View in the current orientation including decorations and
margins.
| |||||||||||
Returns the space occupied by this View in the perpendicular orientation including
decorations and margins.
| |||||||||||
Returns the start of the view including its decoration and margin.
| |||||||||||
Returns the end position of the layout without taking padding into account.
| |||||||||||
Returns the end position of the layout after the end padding is removed.
| |||||||||||
Returns the padding at the end of the layout.
| |||||||||||
Returns the start position of the layout after the start padding is added.
| |||||||||||
Returns the total space to layout.
| |||||||||||
Returns the layout space change between the previous layout pass and current layout pass.
| |||||||||||
Offsets the child in this orientation.
| |||||||||||
Offsets all children's positions by the given amount.
| |||||||||||
Call this method after onLayout method is complete if state is NOT pre-layout.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Creates a horizontal OrientationHelper for the given LayoutManager.
layoutManager | The LayoutManager to attach to. |
---|
Creates an OrientationHelper for the given LayoutManager and orientation.
layoutManager | LayoutManager to attach to |
---|---|
orientation | Desired orientation. Should be HORIZONTAL or VERTICAL |
Creates a vertical OrientationHelper for the given LayoutManager.
layoutManager | The LayoutManager to attach to. |
---|
Returns the end of the view including its decoration and margin.
For example, for the horizontal helper, if a View's right is at pixel 200, has 2px right decoration and 3px right margin, returned value will be 205.
view | The view element to check |
---|
Returns the space occupied by this View in the current orientation including decorations and margins.
view | The view element to check |
---|
Returns the space occupied by this View in the perpendicular orientation including decorations and margins.
view | The view element to check |
---|
Returns the start of the view including its decoration and margin.
For example, for the horizontal helper, if a View's left is at pixel 20, has 2px left decoration and 3px left margin, returned value will be 15px.
view | The view element to check |
---|
Returns the end position of the layout without taking padding into account.
Returns the end position of the layout after the end padding is removed.
Returns the padding at the end of the layout. For horizontal helper, this is the right padding and for vertical helper, this is the bottom padding. This method does not check whether the layout is RTL or not.
Returns the start position of the layout after the start padding is added.
Returns the total space to layout. This number is the difference between
getEndAfterPadding()
and getStartAfterPadding()
.
Returns the layout space change between the previous layout pass and current layout pass.
Make sure you call onLayoutComplete()
at the end of your LayoutManager's
onLayoutChildren(RecyclerView.Recycler, RecyclerView.State)
method.
Offsets the child in this orientation.
view | View to offset |
---|---|
offset | offset amount |
Offsets all children's positions by the given amount.
amount | Value to add to each child's layout parameters |
---|
Call this method after onLayout method is complete if state is NOT pre-layout. This method records information like layout bounds that might be useful in the next layout calculations.