# Layer

Summary:[Fields](https://developer.android.com/reference/android/support/constraint/helper/Layer#lfields)\|[Ctors](https://developer.android.com/reference/android/support/constraint/helper/Layer#pubctors)\|[Methods](https://developer.android.com/reference/android/support/constraint/helper/Layer#pubmethods)\|[Protected Methods](https://developer.android.com/reference/android/support/constraint/helper/Layer#promethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/constraint/helper/Layer#inhmethods)  

# Layer

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The Constraint Layout support library has been superseded by the[AndroidX Constraint Layout library](https://developer.android.com/reference/androidx/constraintlayout/classes), which is part of[Jetpack](https://developer.android.com/jetpack). The`Layer`class has been superseded by[`androidx.constraintlayout.helper.widget.Layer`](https://developer.android.com/reference/androidx/constraintlayout/helper/widget/Layer). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX.

`
public


class
Layer
`  
`


``

extends View


``


`

|---|---|-----------------------------------------|
| java.lang.Object                              |||
| ↳ | View                                       ||
|   | ↳ | android.support.constraint.helper.Layer |

<br />

*** ** * ** ***

**Added in 2.0**

## Summary

|                                                                   ### Fields                                                                    ||
|--------------------|-----------------------------------------------------------------------------------------------------------------------------|
| ` protected float` | [mComputedCenterX](https://developer.android.com/reference/android/support/constraint/helper/Layer#mComputedCenterX) <br /> |
| ` protected float` | [mComputedCenterY](https://developer.android.com/reference/android/support/constraint/helper/Layer#mComputedCenterY) <br /> |
| ` protected float` | [mComputedMaxX](https://developer.android.com/reference/android/support/constraint/helper/Layer#mComputedMaxX) <br />       |
| ` protected float` | [mComputedMaxY](https://developer.android.com/reference/android/support/constraint/helper/Layer#mComputedMaxY) <br />       |
| ` protected float` | [mComputedMinX](https://developer.android.com/reference/android/support/constraint/helper/Layer#mComputedMinX) <br />       |
| ` protected float` | [mComputedMinY](https://developer.android.com/reference/android/support/constraint/helper/Layer#mComputedMinY) <br />       |

|                                                                                    ### Public constructors                                                                                     ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[Layer](https://developer.android.com/reference/android/support/constraint/helper/Layer#Layer(Context))`(Context context) `                                                              |
| ` `[Layer](https://developer.android.com/reference/android/support/constraint/helper/Layer#Layer(Context,%20AttributeSet))`(Context context, AttributeSet attrs) `                          |
| ` `[Layer](https://developer.android.com/reference/android/support/constraint/helper/Layer#Layer(Context,%20AttributeSet,%20int))`(Context context, AttributeSet attrs, int defStyleAttr) ` |

|                                                                                                                                                                                                                                                                                          ### Public methods                                                                                                                                                                                                                                                                                           ||
|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` int[]` | ` `[getReferencedIds](https://developer.android.com/reference/android/support/constraint/helper/Layer#getReferencedIds())`() ` Helpers typically reference a collection of ids                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` void`  | ` `[loadParameters](https://developer.android.com/reference/android/support/constraint/helper/Layer#loadParameters(android.support.constraint.ConstraintSet.Constraint,%20HelperWidget,%20android.support.constraint.ConstraintLayout.LayoutParams,%20<any>))`(`[ConstraintSet.Constraint](https://developer.android.com/reference/android/support/constraint/ConstraintSet.Constraint)` constraint, HelperWidget child, `[ConstraintLayout.LayoutParams](https://developer.android.com/reference/android/support/constraint/ConstraintLayout.LayoutParams)` layoutParams, ` mapIdToWidget) |
| ` void`  | ` `[resolveRtl](https://developer.android.com/reference/android/support/constraint/helper/Layer#resolveRtl(ConstraintWidget,%20boolean))`(ConstraintWidget widget, boolean isRtl) `                                                                                                                                                                                                                                                                                                                                                                                                         |
| ` void`  | ` `[setPivotX](https://developer.android.com/reference/android/support/constraint/helper/Layer#setPivotX(float))`(float pivotX) ` Sets the pivot point for scale operations.                                                                                                                                                                                                                                                                                                                                                                                                                |
| ` void`  | ` `[setPivotY](https://developer.android.com/reference/android/support/constraint/helper/Layer#setPivotY(float))`(float pivotY) ` Sets the pivot point for scale operations.                                                                                                                                                                                                                                                                                                                                                                                                                |
| ` void`  | ` `[setReferencedIds](https://developer.android.com/reference/android/support/constraint/helper/Layer#setReferencedIds(int[]))`(int[] ids) ` Helpers typically reference a collection of ids                                                                                                                                                                                                                                                                                                                                                                                                |
| ` void`  | ` `[setRotation](https://developer.android.com/reference/android/support/constraint/helper/Layer#setRotation(float))`(float angle) ` Rotates all associated views around a single point post layout..                                                                                                                                                                                                                                                                                                                                                                                       |
| ` void`  | ` `[setScaleX](https://developer.android.com/reference/android/support/constraint/helper/Layer#setScaleX(float))`(float scaleX) ` Scales all associated views around a single point post layout..                                                                                                                                                                                                                                                                                                                                                                                           |
| ` void`  | ` `[setScaleY](https://developer.android.com/reference/android/support/constraint/helper/Layer#setScaleY(float))`(float scaleY) ` Scales all associated views around a single point post layout..                                                                                                                                                                                                                                                                                                                                                                                           |
| ` void`  | ` `[setTranslationX](https://developer.android.com/reference/android/support/constraint/helper/Layer#setTranslationX(float))`(float dx) ` Shift all the views in the X direction post layout.                                                                                                                                                                                                                                                                                                                                                                                               |
| ` void`  | ` `[setTranslationY](https://developer.android.com/reference/android/support/constraint/helper/Layer#setTranslationY(float))`(float dy) ` Shift all the views in the Y direction post layout.                                                                                                                                                                                                                                                                                                                                                                                               |
| ` void`  | ` `[updatePostConstraints](https://developer.android.com/reference/android/support/constraint/helper/Layer#updatePostConstraints(android.support.constraint.ConstraintLayout))`(`[ConstraintLayout](https://developer.android.com/reference/android/support/constraint/ConstraintLayout)` constainer) `                                                                                                                                                                                                                                                                                     |
| ` void`  | ` `[updatePreLayout](https://developer.android.com/reference/android/support/constraint/helper/Layer#updatePreLayout(ConstraintWidgetContainer,%20Helper,%20<any>))`(ConstraintWidgetContainer container, Helper helper, ` map)                                                                                                                                                                                                                                                                                                                                                             |

|                                                                                                                                ### Protected methods                                                                                                                                 ||
|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void`   | ` `[calcCenters](https://developer.android.com/reference/android/support/constraint/helper/Layer#calcCenters())`() `                                                                                                                                                      |
| ` View[]` | ` `[getViews](https://developer.android.com/reference/android/support/constraint/helper/Layer#getViews(android.support.constraint.ConstraintLayout))`(`[ConstraintLayout](https://developer.android.com/reference/android/support/constraint/ConstraintLayout)` layout) ` |
| ` void`   | ` `[onAttachedToWindow](https://developer.android.com/reference/android/support/constraint/helper/Layer#onAttachedToWindow())`() `                                                                                                                                        |

| ### Inherited methods |
|-----------------------|---|
| From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## Fields

### mComputedCenterX

```
protected float mComputedCenterX
```

<br />

<br />

### mComputedCenterY

```
protected float mComputedCenterY
```

<br />

<br />

### mComputedMaxX

```
protected float mComputedMaxX
```

<br />

<br />

### mComputedMaxY

```
protected float mComputedMaxY
```

<br />

<br />

### mComputedMinX

```
protected float mComputedMinX
```

<br />

<br />

### mComputedMinY

```
protected float mComputedMinY
```

<br />

<br />

## Public constructors

### Layer

```
public Layer (Context context)
```

<br />

<br />

|         Parameters          ||
|-----------|------------------|
| `context` | `Context` <br /> |

### Layer

```
public Layer (Context context, 
                AttributeSet attrs)
```

<br />

<br />

|            Parameters            ||
|-----------|-----------------------|
| `context` | `Context` <br />      |
| `attrs`   | `AttributeSet` <br /> |

### Layer

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

<br />

<br />

|              Parameters               ||
|----------------|-----------------------|
| `context`      | `Context` <br />      |
| `attrs`        | `AttributeSet` <br /> |
| `defStyleAttr` | `int` <br />          |

## Public methods

### getReferencedIds

```
public int[] getReferencedIds ()
```

Helpers typically reference a collection of ids

<br />

|            Returns             ||
|---------|-----------------------|
| `int[]` | ids referenced <br /> |

### loadParameters

```
public void loadParameters (ConstraintSet.Constraint constraint, 
                HelperWidget child, 
                ConstraintLayout.LayoutParams layoutParams, 
                 mapIdToWidget)
```

<br />

<br />

|                       Parameters                        ||
|-----------------|----------------------------------------|
| `constraint`    | `ConstraintSet.Constraint` <br />      |
| `child`         | `HelperWidget` <br />                  |
| `layoutParams`  | `ConstraintLayout.LayoutParams` <br /> |
| `mapIdToWidget` | <br />                                 |

### resolveRtl

```
public void resolveRtl (ConstraintWidget widget, 
                boolean isRtl)
```

<br />

<br />

|             Parameters              ||
|----------|---------------------------|
| `widget` | `ConstraintWidget` <br /> |
| `isRtl`  | `boolean` <br />          |

### 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.

<br />

|                         Parameters                          ||
|----------|---------------------------------------------------|
| `pivotX` | `float`: The X location of the pivot point <br /> |

### 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.

<br />

|                         Parameters                          ||
|----------|---------------------------------------------------|
| `pivotY` | `float`: The Y location of the pivot point <br /> |

### setReferencedIds

```
public void setReferencedIds (int[] ids)
```

Helpers typically reference a collection of ids

<br />

|     Parameters      ||
|-------|--------------|
| `ids` | `int` <br /> |

|            Returns            ||
|--------|-----------------------|
| `void` | ids referenced <br /> |

### 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;

<br />

### 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;

<br />

|                     Parameters                     ||
|----------|------------------------------------------|
| `scaleX` | `float`: The value to scale in X. <br /> |

### 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;

<br />

|                     Parameters                     ||
|----------|------------------------------------------|
| `scaleY` | `float`: The value to scale in X. <br /> |

### setTranslationX

```
public void setTranslationX (float dx)
```

Shift all the views in the X direction post layout.

<br />

|                   Parameters                   ||
|------|------------------------------------------|
| `dx` | `float`: number of pixes to shift <br /> |

### setTranslationY

```
public void setTranslationY (float dy)
```

Shift all the views in the Y direction post layout.

<br />

|                   Parameters                   ||
|------|------------------------------------------|
| `dy` | `float`: number of pixes to shift <br /> |

### updatePostConstraints

```
public void updatePostConstraints (ConstraintLayout constainer)
```

<br />

<br />

|               Parameters                ||
|--------------|---------------------------|
| `constainer` | `ConstraintLayout` <br /> |

### updatePreLayout

```
public void updatePreLayout (ConstraintWidgetContainer container, 
                Helper helper, 
                 map)
```

<br />

<br />

|                   Parameters                    ||
|-------------|------------------------------------|
| `container` | `ConstraintWidgetContainer` <br /> |
| `helper`    | `Helper` <br />                    |
| `map`       | <br />                             |

## Protected methods

### calcCenters

```
protected void calcCenters ()
```

<br />

<br />

### getViews

```
protected View[] getViews (ConstraintLayout layout)
```

<br />

<br />

|             Parameters              ||
|----------|---------------------------|
| `layout` | `ConstraintLayout` <br /> |

|     Returns      ||
|----------|--------|
| `View[]` | <br /> |

### onAttachedToWindow

```
protected void onAttachedToWindow ()
```

<br />

<br />