# HasBackgroundMatcher

Summary:[Ctors](https://developer.android.com/reference/android/support/test/espresso/matcher/HasBackgroundMatcher#pubctors)\|[Methods](https://developer.android.com/reference/android/support/test/espresso/matcher/HasBackgroundMatcher#pubmethods)\|[Protected Methods](https://developer.android.com/reference/android/support/test/espresso/matcher/HasBackgroundMatcher#promethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/test/espresso/matcher/HasBackgroundMatcher#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/test/espresso/matcher/HasBackgroundMatcher#)  

# HasBackgroundMatcher

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). 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. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public

final

class
HasBackgroundMatcher
`  
`


``


``

extends TypeSafeMatcher<`[View](https://developer.android.com/reference/android/view/View.html)`>


``


`

|---|---|---|------------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||||
| ↳ | org.hamcrest.BaseMatcher\<[android.view.View](https://developer.android.com/reference/android/view/View.html)\> |||
|   | ↳ | org.hamcrest.TypeSafeMatcher\<[android.view.View](https://developer.android.com/reference/android/view/View.html)\> ||
|   |   | ↳ | android.support.test.espresso.matcher.HasBackgroundMatcher |

<br />

*** ** * ** ***

Matcher to match[View](https://developer.android.com/reference/android/view/View.html)based on its background resource.

**This API is currently in beta.**

## Summary

|                                                                            ### Public constructors                                                                            ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[HasBackgroundMatcher](https://developer.android.com/reference/android/support/test/espresso/matcher/HasBackgroundMatcher#HasBackgroundMatcher(int))`(int drawableId) ` |

|                                                                                      ### Public methods                                                                                       ||
|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void` | ` `[describeTo](https://developer.android.com/reference/android/support/test/espresso/matcher/HasBackgroundMatcher#describeTo(org.hamcrest.Description))`(Description description) ` |

|                                                                                                                 ### Protected methods                                                                                                                 ||
|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` boolean` | ` `[matchesSafely](https://developer.android.com/reference/android/support/test/espresso/matcher/HasBackgroundMatcher#matchesSafely(android.view.View))`(`[View](https://developer.android.com/reference/android/view/View.html)` view) ` |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/espresso/matcher/HasBackgroundMatcher#)From class` org.hamcrest.TypeSafeMatcher ` |---------------------|-----------------------------------------------------------------------------------------------------------------------------| | ` final void`       | ` describeMismatch(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0, Description arg1) `      | | ` void`             | ` describeMismatchSafely(`[View](https://developer.android.com/reference/android/view/View.html)` arg0, Description arg1) ` | | ` final boolean`    | ` matches(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0) `                                 | | ` abstract boolean` | ` matchesSafely(`[View](https://developer.android.com/reference/android/view/View.html)` arg0) `                            | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/espresso/matcher/HasBackgroundMatcher#)From class` org.hamcrest.BaseMatcher ` |----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------| | ` final void`                                                              | ` _dont_implement_Matcher___instead_extend_BaseMatcher_() `                                                            | | ` void`                                                                    | ` describeMismatch(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0, Description arg1) ` | | ` `[String](https://developer.android.com/reference/java/lang/String.html) | ` toString() `                                                                                                         | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/espresso/matcher/HasBackgroundMatcher#)From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object.html)` ` |-------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object.html)          | ` clone() `                                                                                | | ` boolean`                                                                          | ` equals(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0) ` | | ` void`                                                                             | ` finalize() `                                                                             | | ` final `[Class](https://developer.android.com/reference/java/lang/Class.html)`<?>` | ` getClass() `                                                                             | | ` int`                                                                              | ` hashCode() `                                                                             | | ` final void`                                                                       | ` notify() `                                                                               | | ` final void`                                                                       | ` notifyAll() `                                                                            | | ` `[String](https://developer.android.com/reference/java/lang/String.html)          | ` toString() `                                                                             | | ` final void`                                                                       | ` wait(long arg0, int arg1) `                                                              | | ` final void`                                                                       | ` wait(long arg0) `                                                                        | | ` final void`                                                                       | ` wait() `                                                                                 | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/espresso/matcher/HasBackgroundMatcher#)From interface` org.hamcrest.Matcher ` |---------------------|------------------------------------------------------------------------------------------------------------------------| | ` abstract void`    | ` _dont_implement_Matcher___instead_extend_BaseMatcher_() `                                                            | | ` abstract void`    | ` describeMismatch(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0, Description arg1) ` | | ` abstract boolean` | ` matches(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0) `                            | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/espresso/matcher/HasBackgroundMatcher#)From interface` org.hamcrest.SelfDescribing ` |------------------|----------------------------------| | ` abstract void` | ` describeTo(Description arg0) ` | ||

## Public constructors

### HasBackgroundMatcher

```
HasBackgroundMatcher (int drawableId)
```

<br />

<br />

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

## Public methods

### describeTo

```
void describeTo (Description description)
```

<br />

<br />

|             Parameters              ||
|---------------|----------------------|
| `description` | `Description` <br /> |

## Protected methods

### matchesSafely

```
boolean matchesSafely (View view)
```

<br />

<br />

|      Parameters       ||
|--------|---------------|
| `view` | `View` <br /> |

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

-

  ## Classes

  - [BoundedMatcher](https://developer.android.com/reference/android/support/test/espresso/matcher/BoundedMatcher)
  - [CursorMatchers](https://developer.android.com/reference/android/support/test/espresso/matcher/CursorMatchers)
  - [CursorMatchers.CursorMatcher](https://developer.android.com/reference/android/support/test/espresso/matcher/CursorMatchers.CursorMatcher)
  - [HasBackgroundMatcher](https://developer.android.com/reference/android/support/test/espresso/matcher/HasBackgroundMatcher)
  - [LayoutMatchers](https://developer.android.com/reference/android/support/test/espresso/matcher/LayoutMatchers)
  - [PreferenceMatchers](https://developer.android.com/reference/android/support/test/espresso/matcher/PreferenceMatchers)
  - [RootMatchers](https://developer.android.com/reference/android/support/test/espresso/matcher/RootMatchers)
  - [ViewMatchers](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers)
-

  ## Enums

  - [ViewMatchers.Visibility](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers.Visibility)