ConstraintHelper
abstract class ConstraintHelper : View
Barrier |
Added in 1.1 |
Group |
Control the visibility and elevation of the referenced views Added in 1.1 |
Layer |
Layer adds the ability to move and rotate a group of views as if they were contained in a viewGroup Added in 2.0 Methods such as setRotation(float) rotate all views about a common center. |
MotionHelper |
|
VirtualLayout |
Added in 2.0 |
Carousel |
Carousel works within a MotionLayout to provide a simple recycler like pattern. |
CircularFlow |
CircularFlow virtual layout. |
Flow |
Flow VirtualLayout. |
Grid |
A helper class that helps arrange widgets in a grid form |
MotionEffect |
MotionHelper that automatically inserts keyframes for views moving in a given direction, out of: |
MotionPlaceholder |
Added in 1.1
This class manages a set of referenced widgets. HelperWidget objects can be created to act upon the set of referenced widgets. The difference between ConstraintHelper and ViewGroup is that multiple ConstraintHelper can reference the same widgets.
Widgets are referenced by being added to a comma separated list of ids, e.g.:
<androidx.constraintlayout.widget.Barrier android:id="@+id/barrier" android:layout_width="wrap_content" android:layout_height="wrap_content" app:barrierDirection="start" app:constraint_referenced_ids="button1,button2" />
Summary
Public constructors |
|---|
ConstraintHelper(context: Context!) |
ConstraintHelper(context: Context!, attrs: AttributeSet!) |
ConstraintHelper(context: Context!, attrs: AttributeSet!, defStyleAttr: Int) |
Public functions |
|
|---|---|
Unit |
Add a view to the helper. |
Unit |
hook for helpers to apply parameters in MotionLayout |
Boolean |
containsId(id: Int)does id table contain the id |
IntArray<Int>! |
Helpers typically reference a collection of ids |
Int |
indexFromId(id: Int)find the position of an id |
java-static Boolean |
isChildOfHelper(v: View!) |
Unit |
loadParameters(Load the parameters |
Unit |
|
Int |
removeView(view: View!)Remove a given view from the helper. |
Unit |
resolveRtl(widget: ConstraintWidget!, isRtl: Boolean)resolve the RTL |
Unit |
setReferencedIds(ids: IntArray!)Helpers typically reference a collection of ids |
Unit |
|
Unit |
updatePostConstraints(container: ConstraintLayout!)update after constraints are resolved |
Unit |
updatePostLayout(container: ConstraintLayout!)Allows a helper a chance to update its internal object post layout or set up connections for the pointed elements |
Unit |
updatePostMeasure(container: ConstraintLayout!) |
Unit |
updatePreDraw(container: ConstraintLayout!)called before the draw |
Unit |
updatePreLayout(container: ConstraintLayout!)Allows a helper a chance to update its internal object pre layout or set up connections for the pointed elements |
Unit |
updatePreLayout(called before solver resolution |
Unit |
Allows a helper to replace the default ConstraintWidget in LayoutParams by its own subclass |
Protected functions |
|
|---|---|
Unit |
|
Unit |
applyLayoutFeatures(container: ConstraintLayout!) |
Unit |
applyLayoutFeaturesInConstraintSet(container: ConstraintLayout!) |
Array<View!>! |
getViews(layout: ConstraintLayout!) |
Unit |
init(attrs: AttributeSet!) |
Unit |
|
Unit |
|
Unit |
|
Unit |
setReferenceTags(tagList: String!) |
Protected properties |
|
|---|---|
Int |
|
Helper! |
|
IntArray<Int>! |
|
HashMap<Int!, String!>! |
|
String! |
|
String! |
|
Boolean |
|
Context! |
Inherited Constants |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Constants
Public constructors
ConstraintHelper
ConstraintHelper(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)
Public functions
addView
fun addView(view: View!): Unit
Add a view to the helper. The referenced view need to be a child of the helper's parent. The view also need to have its id set in order to be added.
| Parameters | |
|---|---|
view: View! |
applyHelperParams
fun applyHelperParams(): Unit
hook for helpers to apply parameters in MotionLayout
containsId
fun containsId(id: Int): Boolean
does id table contain the id
| Parameters | |
|---|---|
id: Int |
| Returns | |
|---|---|
Boolean |
getReferencedIds
fun getReferencedIds(): IntArray<Int>!
Helpers typically reference a collection of ids
indexFromId
fun indexFromId(id: Int): Int
find the position of an id
| Parameters | |
|---|---|
id: Int |
| Returns | |
|---|---|
Int |
loadParameters
fun loadParameters(
constraint: ConstraintSet.Constraint!,
child: HelperWidget!,
layoutParams: ConstraintLayout.LayoutParams!,
mapIdToWidget: SparseArray<ConstraintWidget!>!
): Unit
Load the parameters
| Parameters | |
|---|---|
constraint: ConstraintSet.Constraint! |
|
child: HelperWidget! |
|
layoutParams: ConstraintLayout.LayoutParams! |
|
mapIdToWidget: SparseArray<ConstraintWidget!>! |
removeView
fun removeView(view: View!): Int
Remove a given view from the helper.
| Parameters | |
|---|---|
view: View! |
| Returns | |
|---|---|
Int |
index of view removed |
resolveRtl
fun resolveRtl(widget: ConstraintWidget!, isRtl: Boolean): Unit
resolve the RTL
| Parameters | |
|---|---|
widget: ConstraintWidget! |
|
isRtl: Boolean |
setReferencedIds
fun setReferencedIds(ids: IntArray!): Unit
Helpers typically reference a collection of ids
updatePostConstraints
fun updatePostConstraints(container: ConstraintLayout!): Unit
update after constraints are resolved
| Parameters | |
|---|---|
container: ConstraintLayout! |
updatePostLayout
fun updatePostLayout(container: ConstraintLayout!): Unit
Allows a helper a chance to update its internal object post layout or set up connections for the pointed elements
| Parameters | |
|---|---|
container: ConstraintLayout! |
updatePostMeasure
fun updatePostMeasure(container: ConstraintLayout!): Unit
| Parameters | |
|---|---|
container: ConstraintLayout! |
updatePreDraw
fun updatePreDraw(container: ConstraintLayout!): Unit
called before the draw
| Parameters | |
|---|---|
container: ConstraintLayout! |
updatePreLayout
fun updatePreLayout(container: ConstraintLayout!): Unit
Allows a helper a chance to update its internal object pre layout or set up connections for the pointed elements
| Parameters | |
|---|---|
container: ConstraintLayout! |
updatePreLayout
fun updatePreLayout(
container: ConstraintWidgetContainer!,
helper: Helper!,
map: SparseArray<ConstraintWidget!>!
): Unit
called before solver resolution
| Parameters | |
|---|---|
container: ConstraintWidgetContainer! |
|
helper: Helper! |
|
map: SparseArray<ConstraintWidget!>! |
validateParams
fun validateParams(): Unit
Allows a helper to replace the default ConstraintWidget in LayoutParams by its own subclass
Protected functions
applyLayoutFeatures
protected fun applyLayoutFeatures(container: ConstraintLayout!): Unit
| Parameters | |
|---|---|
container: ConstraintLayout! |
applyLayoutFeaturesInConstraintSet
protected fun applyLayoutFeaturesInConstraintSet(container: ConstraintLayout!): Unit