# Root

Artifact: [androidx.test.espresso:espresso-core](https://developer.android.com/jetpack/androidx/releases/test-espresso) [View Source](https://cs.android.com/search?q=file:androidx/test/espresso/Root.java+class:androidx.test.espresso.Root)

*** ** * ** ***


```
public final class Root
```

<br />

*** ** * ** ***

Represents a root view in the application and optionally the layout params of the window holding it.

This class is used internally to determine which view root to run user provided matchers against it is not part of the public api.

## Summary

| ### Nested types |
|---|
| `public class https://developer.android.com/reference/androidx/test/espresso/Root.Builder` |

| ### Public fields |
|---|---|
| `final https://developer.android.com/reference/android/view/View.html` | `https://developer.android.com/reference/androidx/test/espresso/Root#decorView()` |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/android/view/View.html` | `https://developer.android.com/reference/androidx/test/espresso/Root#getDecorView()()` |
| `https://developer.android.com/reference/androidx/test/espresso/util/EspressoOptional<https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html>` | `[getWindowLayoutParams](https://developer.android.com/reference/androidx/test/espresso/Root#getWindowLayoutParams())()` **This method is deprecated.** use `https://developer.android.com/reference/androidx/test/espresso/Root#getWindowLayoutParams2()` <br /> |
| `https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html` | `https://developer.android.com/reference/androidx/test/espresso/Root#getWindowLayoutParams2()()` |
| `boolean` | `https://developer.android.com/reference/androidx/test/espresso/Root#isReady()()` Checks if the `https://developer.android.com/reference/androidx/test/espresso/Root` is ready. |
| `https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/test/espresso/Root#toString()()` |

## Public fields

### decorView

```
public final View decorView
```

## Public methods

### getDecorView

```
public View getDecorView()
```

### getWindowLayoutParams

```
public EspressoOptional<WindowManager.LayoutParams> [getWindowLayoutParams](https://developer.android.com/reference/androidx/test/espresso/Root#getWindowLayoutParams())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> use `https://developer.android.com/reference/androidx/test/espresso/Root#getWindowLayoutParams2()`

### getWindowLayoutParams2

```
public WindowManager.LayoutParams getWindowLayoutParams2()
```

### isReady

```
public boolean isReady()
```

Checks if the `https://developer.android.com/reference/androidx/test/espresso/Root` is ready. The UI is no longer in flux if layout of the root view is not being requested and the root view has window focus or is focusable.

| Returns |
|---|---|
| `boolean` | if the root view has focus |

### toString

```
public String toString()
```