Layer

public class Layer
extends View

java.lang.Object
   ↳ android.view.View
     ↳ androidx.constraintlayout.helper.widget.Layer


Control the visibility and elevation of the referenced views Added in 2.0

Summary

Inherited constants

Fields

protected float mComputedCenterX

protected float mComputedCenterY

protected float mComputedMaxX

protected float mComputedMaxY

protected float mComputedMinX

protected float mComputedMinY

protected HashMap<Integer, String> mMap

Inherited fields

Public constructors

Layer(Context context)
Layer(Context context, AttributeSet attrs)
Layer(Context context, AttributeSet attrs, int defStyleAttr)

Public methods

void addView(View view)

Add a view to the helper.

boolean containsId(int id)
int[] getReferencedIds()

Helpers typically reference a collection of ids

int indexFromId(int id)
void loadParameters(ConstraintSet.Constraint constraint, HelperWidget child, ConstraintLayout.LayoutParams layoutParams, SparseArray<ConstraintWidget> mapIdToWidget)
int removeView(View view)

Remove a given view from the helper.

void resolveRtl(ConstraintWidget widget, boolean isRtl)
void setPivotX(float pivotX)

Sets the pivot point for scale operations.

void setPivotY(float pivotY)

Sets the pivot point for scale operations.

void setReferencedIds(int[] ids)

Helpers typically reference a collection of ids

void setRotation(float angle)

Rotates all associated views around a single point post layout..

void setScaleX(float scaleX)

Scales all associated views around a single point post layout..

void setScaleY(float scaleY)

Scales all associated views around a single point post layout..

void setTag(int key, Object tag)
void setTranslationX(float dx)

Shift all the views in the X direction post layout.

void setTranslationY(float dy)

Shift all the views in the Y direction post layout.

void updatePostConstraints(ConstraintLayout container)
void updatePreDraw(ConstraintLayout container)
void updatePreLayout(ConstraintWidgetContainer container, Helper helper, SparseArray<ConstraintWidget> map)

Protected methods

void calcCenters()
View[] getViews(ConstraintLayout layout)
void onAttachedToWindow()

Inherited methods

Fields

mComputedCenterX

protected float mComputedCenterX

mComputedCenterY

protected float mComputedCenterY

mComputedMaxX

protected float mComputedMaxX

mComputedMaxY

protected float mComputedMaxY

mComputedMinX

protected float mComputedMinX

mComputedMinY

protected float mComputedMinY

mMap

protected HashMap<Integer, String> mMap

Public constructors

Layer

public Layer (Context context)

Parameters
context Context

Layer

public Layer (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

Layer

public Layer (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

Public methods

addView

public void addView (View view)

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.

containsId

public boolean containsId (int id)

Parameters
id int

Returns
boolean

getReferencedIds

public int[] getReferencedIds ()

Helpers typically reference a collection of ids

Returns
int[] ids referenced

indexFromId

public int indexFromId (int id)

Parameters
id int

Returns
int

loadParameters

public void loadParameters (ConstraintSet.Constraint constraint, 
                HelperWidget child, 
                ConstraintLayout.LayoutParams layoutParams, 
                SparseArray<ConstraintWidget> mapIdToWidget)

Parameters
constraint ConstraintSet.Constraint

child HelperWidget

layoutParams ConstraintLayout.LayoutParams

mapIdToWidget SparseArray

removeView

public int removeView (View view)

Remove a given view from the helper.

Returns
int index of view removed

resolveRtl

public void resolveRtl (ConstraintWidget widget, 
                boolean isRtl)

Parameters
widget ConstraintWidget

isRtl boolean

setPivotX

public void setPivotX (float pivotX)

Sets the pivot point for scale operations. Setting it to Float.NaN (default) results in the center of the group being used.

Parameters
pivotX float: The X location of the pivot point

setPivotY

public void setPivotY (float pivotY)

Sets the pivot point for scale operations. Setting it to Float.NaN (default) results in the center of the group being used.

Parameters
pivotY float: The Y location of the pivot point

setReferencedIds

public void setReferencedIds (int[] ids)

Helpers typically reference a collection of ids

Parameters
ids int

Returns
void ids referenced

setRotation

public void setRotation (float angle)

Rotates all associated views around a single point post layout.. The point is the middle of the bounding box or set by setPivotX,setPivotX;

setScaleX

public void setScaleX (float scaleX)

Scales all associated views around a single point post layout.. The point is the middle of the bounding box or set by setPivotX,setPivotX;

Parameters
scaleX float: The value to scale in X.

setScaleY

public void setScaleY (float scaleY)

Scales all associated views around a single point post layout.. The point is the middle of the bounding box or set by setPivotX,setPivotX;

Parameters
scaleY float: The value to scale in X.

setTag

public void setTag (int key, 
                Object tag)

Parameters
key int

tag Object

setTranslationX

public void setTranslationX (float dx)

Shift all the views in the X direction post layout.

Parameters
dx float: number of pixes to shift

setTranslationY

public void setTranslationY (float dy)

Shift all the views in the Y direction post layout.

Parameters
dy float: number of pixes to shift

updatePostConstraints

public void updatePostConstraints (ConstraintLayout container)

Parameters
container ConstraintLayout

updatePreDraw

public void updatePreDraw (ConstraintLayout container)

Parameters
container ConstraintLayout

updatePreLayout

public void updatePreLayout (ConstraintWidgetContainer container, 
                Helper helper, 
                SparseArray<ConstraintWidget> map)

Parameters
container ConstraintWidgetContainer

helper Helper

map SparseArray

Protected methods

calcCenters

protected void calcCenters ()

getViews

protected View[] getViews (ConstraintLayout layout)

Parameters
layout ConstraintLayout

Returns
View[]

onAttachedToWindow

protected void onAttachedToWindow ()