# ListItemRevealLayout

[View Source](https://github.com/material-components/material-components-android/blob/1.14.0/lib/java/com/google/android/material/listitem/ListItemRevealLayout.java)

*** ** * ** ***


```
public class ListItemRevealLayout implements RevealableListItem
```

<br />

*** ** * ** ***

Layout that is intended to be used as the android.view.ViewGroup that is revealed when a a `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem` is swiped. This layout always measures its width intrinsically, and uses its direct children's intrinsic width ratios to re-size them accordingly when the layout width changes.

Eg. If ListItemRevealLayout has an intrinsic width of 100 pixels with the first child having an intrinsic width of 20 and the second child having an intrinsic width of 80, when the ListItemRevealLayout changes to a width of 50, the ratios will be kept the same. The first child will have a width of 10 and the second will have a width of 40.

ListItemRevealLayout will be measured at 0 pixels if the desired width is not set.

## Summary

| ### Public fields |
|---|---|
| `int` | `https://developer.android.com/reference/com/google/android/material/listitem/ListItemRevealLayout#intrinsicWidth()` |
| `int` | `https://developer.android.com/reference/com/google/android/material/listitem/ListItemRevealLayout#minChildWidth()` |
| `int` | `https://developer.android.com/reference/com/google/android/material/listitem/ListItemRevealLayout#primaryActionSwipeMode()` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/com/google/android/material/listitem/ListItemRevealLayout#ListItemRevealLayout(Context)(Context context)` |
| `https://developer.android.com/reference/com/google/android/material/listitem/ListItemRevealLayout#ListItemRevealLayout(Context,AttributeSet)(Context context, AttributeSet attrs)` |
| `https://developer.android.com/reference/com/google/android/material/listitem/ListItemRevealLayout#ListItemRevealLayout(Context,AttributeSet,int)( Context context, AttributeSet attrs, int defStyleAttr )` |
| `https://developer.android.com/reference/com/google/android/material/listitem/ListItemRevealLayout#ListItemRevealLayout(Context,AttributeSet,int,int)( Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes )` |

| ### Public methods |
|---|---|
| `LayoutParams` | `https://developer.android.com/reference/com/google/android/material/listitem/ListItemRevealLayout#generateLayoutParams(AttributeSet)(AttributeSet attrs)` |
| `int` | `https://developer.android.com/reference/com/google/android/material/listitem/ListItemRevealLayout#getIntrinsicWidth()()` Returns the intrinsic width of the RevealableListItem. |
| `int` | `https://developer.android.com/reference/com/google/android/material/listitem/ListItemRevealLayout#getMinChildWidth()()` Sets the minimum width, in pixels, that the children of ListItemRevealLayout can be measured to be. |
| `int` | `https://developer.android.com/reference/com/google/android/material/listitem/ListItemRevealLayout#getPrimaryActionSwipeMode()()` Returns the `https://developer.android.com/reference/com/google/android/material/listitem/RevealableListItem.PrimaryActionSwipeMode` for the RevealableListItem that defines the swipe to primary action behavior when swiping with a sibling `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem`. |
| `void` | `https://developer.android.com/reference/com/google/android/material/listitem/ListItemRevealLayout#resetIntrinsicWidth()()` Resets the intrinsic width remembered by the ListItemRevealLayout. |
| `void` | `https://developer.android.com/reference/com/google/android/material/listitem/ListItemRevealLayout#setMinChildWidth(int)(int minChildWidth)` Sets the minimum width, in pixels, that the children of ListItemRevealLayout can be measured to be. |
| `void` | `https://developer.android.com/reference/com/google/android/material/listitem/ListItemRevealLayout#setPrimaryActionSwipeMode(int)(int primaryActionSwipeMode)` Sets the swipe-to-primary-action behavior of this RevealableListItem when swiping with a sibling `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem`. |
| `void` | `https://developer.android.com/reference/com/google/android/material/listitem/ListItemRevealLayout#setRevealedWidth(int)(int revealedWidth)` Sets the revealed width of RevealableListItem, in pixels. |

| ### Protected methods |
|---|---|
| `LayoutParams` | `https://developer.android.com/reference/com/google/android/material/listitem/ListItemRevealLayout#generateDefaultLayoutParams()()` |
| `LayoutParams` | `https://developer.android.com/reference/com/google/android/material/listitem/ListItemRevealLayout#generateLayoutParams(LayoutParams)(LayoutParams p)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/listitem/ListItemRevealLayout#onLayout(boolean,int,int,int,int)(boolean changed, int l, int t, int r, int b)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/listitem/ListItemRevealLayout#onMeasure(int,int)(int widthMeasureSpec, int heightMeasureSpec)` |

| ### Inherited Constants |
|---|
| From [com.google.android.material.listitem.RevealableListItem](https://developer.android.com/reference/com/google/android/material/listitem/RevealableListItem) |---|---| | `static final int` | `https://developer.android.com/reference/com/google/android/material/listitem/RevealableListItem#PRIMARY_ACTION_SWIPE_DIRECT() = 2` When swiping with a sibling `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem`, swipe directly to the primary action. | | `static final int` | `https://developer.android.com/reference/com/google/android/material/listitem/RevealableListItem#PRIMARY_ACTION_SWIPE_DISABLED() = 0` Disable the primary action. | | `static final int` | `https://developer.android.com/reference/com/google/android/material/listitem/RevealableListItem#PRIMARY_ACTION_SWIPE_INDIRECT() = 1` When swiping with a sibling `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem`, allow swiping to intermediary states before the primary action. | |

| ### Inherited methods |
|---|
| From [com.google.android.material.listitem.RevealableListItem](https://developer.android.com/reference/com/google/android/material/listitem/RevealableListItem) |---|---| | `abstract void` | `https://developer.android.com/reference/com/google/android/material/listitem/RevealableListItem#setPrimaryActionSwipeMode(int)(int swipeToPrimaryActionMode)` Sets the `https://developer.android.com/reference/com/google/android/material/listitem/RevealableListItem.PrimaryActionSwipeMode` for the RevealableListItem that defines the swipe to primary action behavior when swiping with a sibling `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem`. | |

## Public fields

### intrinsicWidth

```
public int intrinsicWidth
```

### minChildWidth

```
public int minChildWidth
```

### primaryActionSwipeMode

```
public int primaryActionSwipeMode
```

## Public constructors

### ListItemRevealLayout

```
public ListItemRevealLayout(Context context)
```

### ListItemRevealLayout

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

### ListItemRevealLayout

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

### ListItemRevealLayout

```
public ListItemRevealLayout(
    Context context,
    AttributeSet attrs,
    int defStyleAttr,
    int defStyleRes
)
```

## Public methods

### generateLayoutParams

```
public LayoutParams generateLayoutParams(AttributeSet attrs)
```

### getIntrinsicWidth

```
public int getIntrinsicWidth()
```

Returns the intrinsic width of the RevealableListItem. This may be 0 if an intrinsic width has not yet been measured.

### getMinChildWidth

```
public int getMinChildWidth()
```

Sets the minimum width, in pixels, that the children of ListItemRevealLayout can be measured to be.

### getPrimaryActionSwipeMode

```
public int getPrimaryActionSwipeMode()
```

Returns the `https://developer.android.com/reference/com/google/android/material/listitem/RevealableListItem.PrimaryActionSwipeMode` for the RevealableListItem that defines the swipe to primary action behavior when swiping with a sibling `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem`.

### resetIntrinsicWidth

```
public void resetIntrinsicWidth()
```

Resets the intrinsic width remembered by the ListItemRevealLayout. This will cause a re-measure of the ListItemRevealLayout and its children, and should only be called when a re-measure is necessary due to a width change in the layout or any of its children (eg. if a child's visibility changes).

### setMinChildWidth

```
public void setMinChildWidth(int minChildWidth)
```

Sets the minimum width, in pixels, that the children of ListItemRevealLayout can be measured to be.

### setPrimaryActionSwipeMode

```
public void setPrimaryActionSwipeMode(int primaryActionSwipeMode)
```

Sets the swipe-to-primary-action behavior of this RevealableListItem when swiping with a sibling `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem`.

Use onSwipeStateChanged to listen for when the primary action is triggered to initiate the action.

### setRevealedWidth

```
public void setRevealedWidth(int revealedWidth)
```

Sets the revealed width of RevealableListItem, in pixels.

## Protected methods

### generateDefaultLayoutParams

```
protected LayoutParams generateDefaultLayoutParams()
```

### generateLayoutParams

```
protected LayoutParams generateLayoutParams(LayoutParams p)
```

### onLayout

```
protected void onLayout(boolean changed, int l, int t, int r, int b)
```

### onMeasure

```
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
```