ConstraintHelper

abstract class ConstraintHelper

Known direct subclasses
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

Known indirect subclasses
Carousel

Carousel works within a MotionLayout to provide a simple recycler like pattern.

CircularFlow

CircularFlow virtual layout.

Flow

Flow VirtualLayout.

MotionEffect

MotionHelper that automatically inserts keyframes for views moving in a given direction, out of:


Summary

Public constructors

ConstraintHelper(context: Context, attrs: AttributeSet, defStyleAttr: Int)

Public functions

Unit
addView(view: View)

Add a view to the helper.

Boolean
Array<Int>

Helpers typically reference a collection of ids

Int
Unit
loadParameters(
    constraint: ConstraintSet.Constraint,
    child: HelperWidget,
    layoutParams: ConstraintLayout.LayoutParams,
    mapIdToWidget: SparseArray<ConstraintWidget>
)
@Override Unit
onDraw(canvas: Canvas)
Int

Remove a given view from the helper.

Unit
resolveRtl(widget: ConstraintWidget, isRtl: Boolean)
Unit

Helpers typically reference a collection of ids

@Override Unit
setTag(key: Int, tag: Any)
Unit
Unit
Unit
Unit
Unit
Unit
updatePreLayout(
    container: ConstraintWidgetContainer,
    helper: Helper,
    map: SparseArray<ConstraintWidget>
)
Unit

Inherited functions

From class View
Unit
Unit
addExtraDataToAccessibilityNodeInfo(
    info: AccessibilityNodeInfo,
    extraDataKey: String,
    arguments: Bundle
)
Unit
addFocusables(views: ArrayList<View>, direction: Int)
Unit
Unit
Unit
Unit
Unit
ViewPropertyAnimator
Unit
Unit
Unit
Unit

This function is deprecated.

Unit
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Unit
Unit
Unit
Boolean
Unit
Unit
Int
combineMeasuredStates(curState: Int, newState: Int)
Unit
WindowInsets
AccessibilityNodeInfo
Unit
Unit

This function is deprecated.

WindowInsets
Boolean
Unit
Unit
Boolean
Unit
Unit
Boolean
Boolean
Boolean
Boolean
Boolean
dispatchNestedFling(velocityX: Float, velocityY: Float, consumed: Boolean)
Boolean
dispatchNestedPreFling(velocityX: Float, velocityY: Float)
Boolean
dispatchNestedPrePerformAccessibilityAction(
    action: Int,
    arguments: Bundle
)
Boolean
dispatchNestedPreScroll(
    dx: Int,
    dy: Int,
    consumed: Array<Int>,
    offsetInWindow: Array<Int>
)
Boolean
dispatchNestedScroll(
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    offsetInWindow: Array<Int>
)
Unit
Boolean
Unit
Unit
Unit
Unit

This function is deprecated.

Boolean
Boolean
Boolean
dispatchUnhandledMove(focused: View, direction: Int)
Unit
Unit
Unit
WindowInsets
dispatchWindowInsetsAnimationProgress(
    insets: WindowInsets,
    runningAnimations: List<WindowInsetsAnimation>
)
WindowInsetsAnimation.Bounds
Unit

This function is deprecated.

Unit
Unit
draw(canvas: Canvas)
Unit
View
T
<T : View?> findViewById(id: Int)
T
<T : View?> findViewWithTag(tag: Any)
Unit
findViewsWithText(
    outViews: ArrayList<View>,
    searched: CharSequence,
    flags: Int
)
View
focusSearch(direction: Int)
Unit
forceHasOverlappingRendering(hasOverlappingRendering: Boolean)
Unit
Int
CharSequence
View.AccessibilityDelegate
Int
AccessibilityNodeProvider
CharSequence
Int
Int
Float
Animation
Matrix
IBinder
Array<Int>
Map<IntInt>
Array<String>
AutofillId
Int
AutofillValue
Drawable
BlendMode
ColorStateList
PorterDuff.Mode
Int
Int
Float
Rect
Boolean
getClipBounds(outRect: Rect)
Boolean
ContentCaptureSession
CharSequence
Context
Boolean
Int
getDefaultSize(size: Int, measureSpec: Int)
Display
Array<Int>
Bitmap

This function is deprecated.

Int

This function is deprecated.

Int

This function is deprecated.

Unit
getDrawingRect(outRect: Rect)
Long
Float
Int
Boolean
Boolean
Int
ArrayList<View>
getFocusables(direction: Int)
Unit
Drawable
Int
BlendMode
ColorStateList
PorterDuff.Mode
Boolean
getGlobalVisibleRect(r: Rect, globalOffset: Point)
Handler
Boolean
Int
Unit
getHitRect(outRect: Rect)
Int
Drawable
Drawable
Int
Int
Int
Int
Boolean
KeyEvent.DispatcherState
Int
Int
Int
ViewGroup.LayoutParams
Int
Boolean
Unit
Unit
getLocationInWindow(outLocation: Array<Int>)
Unit
getLocationOnScreen(outLocation: Array<Int>)
Matrix
Int
Int
Int
Int
Int
Int
Int
Int
Int
Int
Int
Int
Int
View.OnFocusChangeListener
Int
ViewOutlineProvider
Int
Int
ViewOverlay
Int
Int
Int
Int
Int
Int
ViewParent
ViewParent
Float
Float
PointerIcon
Resources
Boolean
Int
View
WindowInsets
Float
Float
Float
Float
Float
Int
Int
Int
Int
Int
Int
Int
Int
Int
CharSequence
StateListAnimator
List<Rect>
Int

This function is deprecated.

Any
Int
Int
CharSequence
Int
TouchDelegate
ArrayList<View>
Float
String
Float
Float
Float
Long
Int
Int
Drawable
Drawable
Int
ViewTreeObserver
Int
Int
WindowId
WindowInsetsController
Int

This function is deprecated.

IBinder
Int
Unit
Float
Float
Float
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
View
inflate(context: Context, resource: Int, root: ViewGroup)
Unit
invalidate(dirty: Rect)

This function is deprecated.

Unit
Unit
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean

This function is deprecated.

Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Unit
View
keyboardNavigationClusterSearch(currentCluster: View, direction: Int)
Unit
layout(l: Int, t: Int, r: Int, b: Int)
Unit
measure(widthMeasureSpec: Int, heightMeasureSpec: Int)
Unit
Unit
WindowInsets
Unit
Boolean
Boolean
InputConnection
Boolean
Unit
Boolean
Unit
Boolean
Unit
Boolean
Unit
Unit
Boolean
onKeyDown(keyCode: Int, event: KeyEvent)
Boolean
onKeyLongPress(keyCode: Int, event: KeyEvent)
Boolean
onKeyMultiple(keyCode: Int, repeatCount: Int, event: KeyEvent)
Boolean
onKeyPreIme(keyCode: Int, event: KeyEvent)
Boolean
onKeyShortcut(keyCode: Int, event: KeyEvent)
Boolean
onKeyUp(keyCode: Int, event: KeyEvent)
Unit
Unit
Unit
Unit
Unit
Unit
Unit
PointerIcon
onResolvePointerIcon(event: MotionEvent, pointerIndex: Int)
Unit
onRtlPropertiesChanged(layoutDirection: Int)
Unit
onScreenStateChanged(screenState: Int)
Unit
Boolean
Boolean
Unit
Unit
onWindowFocusChanged(hasWindowFocus: Boolean)
Unit

This function is deprecated.

Boolean
performAccessibilityAction(action: Int, arguments: Bundle)
Boolean
Boolean
Boolean
performHapticFeedback(feedbackConstant: Int)
Boolean
Unit
playSoundEffect(soundConstant: Int)
Boolean
post(action: Runnable)
Boolean
postDelayed(action: Runnable, delayMillis: Long)
Unit
Unit
postInvalidateDelayed(delayMilliseconds: Long)
Unit
Unit
Unit
postOnAnimationDelayed(action: Runnable, delayMillis: Long)
Unit
Unit
Boolean
Unit
Unit
Unit
Unit
Unit

This function is deprecated.

Boolean
Boolean
Unit
Unit
Boolean
Unit
T
<T : View?> requireViewById(id: Int)
Unit
Int
resolveSize(size: Int, measureSpec: Int)
Int
resolveSizeAndState(size: Int, measureSpec: Int, childMeasuredState: Int)
Boolean
Unit
Unit
saveAttributeDataForStyleable(
    context: Context,
    styleable: Array<Int>,
    attrs: AttributeSet,
    t: TypedArray,
    defStyleAttr: Int,
    defStyleRes: Int
)
Unit
Unit
scheduleDrawable(who: Drawable, what: Runnable, when: Long)
Unit
scrollBy(x: Int, y: Int)
Unit
scrollTo(x: Int, y: Int)
Unit
Unit
Unit
Unit
Unit
Unit
setAccessibilityPaneTitle(accessibilityPaneTitle: CharSequence)
Unit
Unit
Unit
setActivated(activated: Boolean)
Unit
setAlpha(alpha: Float)
Unit
setAnimation(animation: Animation)
Unit
Unit
setAutofillHints(autofillHints: Array<String>)
Unit
Unit
setBackground(background: Drawable)
Unit
Unit

This function is deprecated.

Unit
Unit
Unit
Unit
Unit
setBottom(bottom: Int)
Unit
Unit
setClickable(clickable: Boolean)
Unit
setClipBounds(clipBounds: Rect)
Unit
setClipToOutline(clipToOutline: Boolean)
Unit
Unit
setContentDescription(contentDescription: CharSequence)
Unit
setContextClickable(contextClickable: Boolean)
Unit
setDefaultFocusHighlightEnabled(defaultFocusHighlightEnabled: Boolean)
Unit

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit
Unit
setElevation(elevation: Float)
Unit
setEnabled(enabled: Boolean)
Unit
Unit
Unit
setFitsSystemWindows(fitSystemWindows: Boolean)
Unit
setFocusable(focusable: Boolean)
Unit
setFocusableInTouchMode(focusableInTouchMode: Boolean)
Unit
setFocusedByDefault(isFocusedByDefault: Boolean)
Unit
Unit
setForeground(foreground: Drawable)
Unit
Unit
Unit
Unit
Unit
setHapticFeedbackEnabled(hapticFeedbackEnabled: Boolean)
Unit
setHasTransientState(hasTransientState: Boolean)
Unit
setHorizontalFadingEdgeEnabled(horizontalFadingEdgeEnabled: Boolean)
Unit
setHorizontalScrollBarEnabled(horizontalScrollBarEnabled: Boolean)
Unit
Unit
Unit
setHovered(hovered: Boolean)
Unit
setId(id: Int)
Unit
Unit
Unit
Unit
setKeepScreenOn(keepScreenOn: Boolean)
Unit
Unit
Unit
Unit
setLayerType(layerType: Int, paint: Paint)
Unit
setLayoutDirection(layoutDirection: Int)
Unit
Unit
setLeft(left: Int)
Unit
setLeftTopRightBottom(left: Int, top: Int, right: Int, bottom: Int)
Unit
setLongClickable(longClickable: Boolean)
Unit
setMinimumHeight(minHeight: Int)
Unit
setMinimumWidth(minWidth: Int)
Unit
Unit
setNextClusterForwardId(nextClusterForwardId: Int)
Unit
setNextFocusDownId(nextFocusDownId: Int)
Unit
setNextFocusForwardId(nextFocusForwardId: Int)
Unit
setNextFocusLeftId(nextFocusLeftId: Int)
Unit
setNextFocusRightId(nextFocusRightId: Int)
Unit
setNextFocusUpId(nextFocusUpId: Int)
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit

This function is deprecated.

Unit
Unit
Unit
Unit
Unit
setOverScrollMode(overScrollMode: Int)
Unit
setPadding(left: Int, top: Int, right: Int, bottom: Int)
Unit
setPaddingRelative(start: Int, top: Int, end: Int, bottom: Int)
Unit
setPivotX(pivotX: Float)
Unit
setPivotY(pivotY: Float)
Unit
Unit
setPressed(pressed: Boolean)
Unit
setRevealOnFocusHint(revealOnFocus: Boolean)
Unit
setRight(right: Int)
Unit
setRotation(rotation: Float)
Unit
setRotationX(rotationX: Float)
Unit
setRotationY(rotationY: Float)
Unit
Unit
Unit
setScaleX(scaleX: Float)
Unit
setScaleY(scaleY: Float)
Unit
setScreenReaderFocusable(screenReaderFocusable: Boolean)
Unit
setScrollBarDefaultDelayBeforeFade(
    scrollBarDefaultDelayBeforeFade: Int
)
Unit
setScrollBarFadeDuration(scrollBarFadeDuration: Int)
Unit
setScrollBarSize(scrollBarSize: Int)
Unit
Unit
setScrollContainer(isScrollContainer: Boolean)
Unit
setScrollIndicators(indicators: Int)
Unit
setScrollX(value: Int)
Unit
setScrollY(value: Int)
Unit
Unit
setSelected(selected: Boolean)
Unit
setSoundEffectsEnabled(soundEffectsEnabled: Boolean)
Unit
setStateDescription(stateDescription: CharSequence)
Unit
Unit
Unit

This function is deprecated.

Unit
setTag(tag: Any)
Unit
setTextAlignment(textAlignment: Int)
Unit
setTextDirection(textDirection: Int)
Unit
Unit
setTop(top: Int)
Unit
Unit
Unit
setTransitionName(transitionName: String)
Unit
Unit
setTranslationX(translationX: Float)
Unit
setTranslationY(translationY: Float)
Unit
setTranslationZ(translationZ: Float)
Unit
setVerticalFadingEdgeEnabled(verticalFadingEdgeEnabled: Boolean)
Unit
setVerticalScrollBarEnabled(verticalScrollBarEnabled: Boolean)
Unit
Unit
Unit
Unit
setVisibility(visibility: Int)
Unit
setWillNotCacheDrawing(willNotCacheDrawing: Boolean)

This function is deprecated.

Unit
setWillNotDraw(willNotDraw: Boolean)
Unit
Unit
setX(x: Float)
Unit
setY(y: Float)
Unit
setZ(z: Float)
Boolean
ActionMode
Unit
Boolean
startDrag(
    data: ClipData,
    shadowBuilder: View.DragShadowBuilder,
    myLocalState: Any,
    flags: Int
)

This function is deprecated.

Boolean
startDragAndDrop(
    data: ClipData,
    shadowBuilder: View.DragShadowBuilder,
    myLocalState: Any,
    flags: Int
)
Boolean
Unit
String
Unit
Unit
Unit
Unit
Boolean

This function is deprecated.

Boolean

Public constructors

ConstraintHelper

ConstraintHelper(context: Context)

ConstraintHelper

ConstraintHelper(context: Context, attrs: AttributeSet)

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

containsId

fun containsId(id: Int): Boolean

getReferencedIds

fun getReferencedIds(): Array<Int>

Helpers typically reference a collection of ids

Returns
Array<Int>

ids referenced

indexFromId

fun indexFromId(id: Int): Int

loadParameters

fun loadParameters(
    constraint: ConstraintSet.Constraint,
    child: HelperWidget,
    layoutParams: ConstraintLayout.LayoutParams,
    mapIdToWidget: SparseArray<ConstraintWidget>
): Unit

onDraw

@Override
fun onDraw(canvas: Canvas): @Override Unit

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

setReferencedIds

fun setReferencedIds(ids: Array<Int>): Unit

Helpers typically reference a collection of ids

Returns
Unit

ids referenced

setTag

@Override
fun setTag(key: Int, tag: Any): @Override Unit

updatePostConstraints

fun updatePostConstraints(container: ConstraintLayout): Unit

updatePostLayout

fun updatePostLayout(container: ConstraintLayout): Unit
Parameters
container: ConstraintLayout

updatePostMeasure

fun updatePostMeasure(container: ConstraintLayout): Unit
Parameters
container: ConstraintLayout

updatePreDraw

fun updatePreDraw(container: ConstraintLayout): Unit

updatePreLayout

fun updatePreLayout(container: ConstraintLayout): Unit
Parameters
container: ConstraintLayout

updatePreLayout

fun updatePreLayout(
    container: ConstraintWidgetContainer,
    helper: Helper,
    map: SparseArray<ConstraintWidget>
): Unit

validateParams

fun validateParams(): Unit