# ViewMatchers

Summary:[Nested Classes](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#nestedclasses)\|[Methods](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#)  

# ViewMatchers

| 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
ViewMatchers
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object.html)`


``


`

|---|----------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||
| ↳ | android.support.test.espresso.matcher.ViewMatchers |

<br />

*** ** * ** ***

A collection of hamcrest matchers that match[View](https://developer.android.com/reference/android/view/View.html)s.

## Summary

|                                                                                                                                   ### Nested classes                                                                                                                                   ||
|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` enum` | [ViewMatchers.Visibility](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers.Visibility) Enumerates the possible list of values for[getVisibility()](https://developer.android.com/reference/android/view/View.html#getVisibility()). |

|                                                                                                                                                                                                                                                                                                                        ### Public methods                                                                                                                                                                                                                                                                                                                         ||
|---------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static <T> void`                                                                          | ` `[assertThat](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#assertThat(java.lang.String, T, org.hamcrest.Matcher<T>))`(`[String](https://developer.android.com/reference/java/lang/String.html)` message, T actual, Matcher<T> matcher) ` A replacement for MatcherAssert.assertThat that renders View objects nicely.                                                                                                                                                                                                |
| ` static <T> void`                                                                          | ` `[assertThat](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#assertThat(T, org.hamcrest.Matcher<T>))`(T actual, Matcher<T> matcher) ` A replacement for MatcherAssert.assertThat that renders View objects nicely.                                                                                                                                                                                                                                                                                                     |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[hasBackground](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#hasBackground(int))`(int drawableId) ` Returns a matcher that matches[View](https://developer.android.com/reference/android/view/View.html)based on background resource.                                                                                                                                                                                                                                                                               |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[hasChildCount](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#hasChildCount(int))`(int childCount) ` Matches a[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html)if it has exactly the specified number of children.                                                                                                                                                                                                                                                                    |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[hasContentDescription](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#hasContentDescription())`() ` Returns an[`Matcher`](http://hamcrest.org/JavaHamcrest/javadoc/1.3/org/hamcrest/Matcher.html)that matches[Views](https://developer.android.com/reference/android/view/View.html)with any content description.                                                                                                                                                                                                    |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[hasDescendant](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#hasDescendant(org.hamcrest.Matcher<android.view.View>))`(Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`> descendantMatcher) ` Returns a matcher that matches[Views](https://developer.android.com/reference/android/view/View.html)based on the presence of a descendant in its view hierarchy.                                                                                                                      |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[hasErrorText](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#hasErrorText(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String.html)` expectedError) ` Returns a matcher that matches[EditText](https://developer.android.com/reference/android/widget/EditText.html)based on edit text error string value.                                                                                                                                                                        |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[hasErrorText](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#hasErrorText(org.hamcrest.Matcher<java.lang.String>))`(Matcher<`[String](https://developer.android.com/reference/java/lang/String.html)`> stringMatcher) ` Returns a matcher that matches[EditText](https://developer.android.com/reference/android/widget/EditText.html)based on edit text error string value.                                                                                                                                         |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[hasFocus](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#hasFocus())`() ` Returns a matcher that matches[Views](https://developer.android.com/reference/android/view/View.html)currently have focus.                                                                                                                                                                                                                                                                                                                 |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[hasImeAction](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#hasImeAction(int))`(int imeAction) ` Returns a matcher that matches views that support input methods (e.g.                                                                                                                                                                                                                                                                                                                                              |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[hasImeAction](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#hasImeAction(org.hamcrest.Matcher<java.lang.Integer>))`(Matcher<`[Integer](https://developer.android.com/reference/java/lang/Integer.html)`> imeActionMatcher) ` Returns a matcher that matches views that support input methods (e.g.                                                                                                                                                                                                                  |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[hasLinks](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#hasLinks())`() ` Returns a matcher that matches[TextViews](https://developer.android.com/reference/android/widget/TextView.html)that have links.                                                                                                                                                                                                                                                                                                            |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[hasMinimumChildCount](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#hasMinimumChildCount(int))`(int minChildCount) ` Matches a[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html)if it has at least the specified number of children.                                                                                                                                                                                                                                                  |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[hasSibling](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#hasSibling(org.hamcrest.Matcher<android.view.View>))`(Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`> siblingMatcher) ` Returns an[`Matcher`](http://hamcrest.org/JavaHamcrest/javadoc/1.3/org/hamcrest/Matcher.html)that matches[Views](https://developer.android.com/reference/android/view/View.html)based on their siblings.                                                                                        |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[hasTextColor](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#hasTextColor(int))`(int colorResId) ` Returns a matcher that matches[TextView](https://developer.android.com/reference/android/widget/TextView.html)based on it's color.                                                                                                                                                                                                                                                                                |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[isAssignableFrom](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#isAssignableFrom(java.lang.Class<? extends android.view.View>))`(`[Class](https://developer.android.com/reference/java/lang/Class.html)`<? extends `[View](https://developer.android.com/reference/android/view/View.html)`> clazz) ` Matches[Views](https://developer.android.com/reference/android/view/View.html)based on instance or subclass of the provided class.                                                                            |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[isChecked](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#isChecked())`() ` Returns a matcher that accepts if and only if the view is a CompoundButton (or subtype of) and is in checked state.                                                                                                                                                                                                                                                                                                                      |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[isClickable](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#isClickable())`() ` Returns a matcher that matches[Views](https://developer.android.com/reference/android/view/View.html)that are clickable.                                                                                                                                                                                                                                                                                                             |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[isCompletelyDisplayed](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#isCompletelyDisplayed())`() ` Returns a matcher which only accepts a view whose height and width fit perfectly within the currently displayed region of this view.                                                                                                                                                                                                                                                                             |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[isDescendantOfA](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#isDescendantOfA(org.hamcrest.Matcher<android.view.View>))`(Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`> ancestorMatcher) ` Returns a matcher that matches[Views](https://developer.android.com/reference/android/view/View.html)based on the given ancestor type.                                                                                                                                               |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[isDisplayed](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#isDisplayed())`() ` Returns a matcher that matches[Views](https://developer.android.com/reference/android/view/View.html)that are currently displayed on the screen to the user.                                                                                                                                                                                                                                                                         |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[isDisplayingAtLeast](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#isDisplayingAtLeast(int))`(int areaPercentage) ` Returns a matcher which accepts a view so long as a given percentage of that view's area is not obscured by any parent view and is thus visible to the user.                                                                                                                                                                                                                                    |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[isEnabled](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#isEnabled())`() ` Returns a matcher that matches[Views](https://developer.android.com/reference/android/view/View.html)that are enabled.                                                                                                                                                                                                                                                                                                                   |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[isFocusable](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#isFocusable())`() ` Returns a matcher that matches[Views](https://developer.android.com/reference/android/view/View.html)that are focusable.                                                                                                                                                                                                                                                                                                             |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[isJavascriptEnabled](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#isJavascriptEnabled())`() ` Returns a matcher that matches[WebView](https://developer.android.com/reference/android/webkit/WebView.html)if they are evaluating`JavaScript`.                                                                                                                                                                                                                                                                      |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[isNotChecked](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#isNotChecked())`() ` Returns a matcher that accepts if and only if the view is a CompoundButton (or subtype of) and is not in checked state.                                                                                                                                                                                                                                                                                                            |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[isRoot](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#isRoot())`() ` Returns a matcher that matches root[View](https://developer.android.com/reference/android/view/View.html).                                                                                                                                                                                                                                                                                                                                     |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[isSelected](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#isSelected())`() ` Returns a matcher that matches[Views](https://developer.android.com/reference/android/view/View.html)that are selected.                                                                                                                                                                                                                                                                                                                |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[supportsInputMethods](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#supportsInputMethods())`() ` Returns a matcher that matches views that support input methods.                                                                                                                                                                                                                                                                                                                                                   |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withAlpha](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withAlpha(float))`(float alpha) ` Matches[Views](https://developer.android.com/reference/android/view/View.html)with the specified alpha value.                                                                                                                                                                                                                                                                                                            |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withChild](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withChild(org.hamcrest.Matcher<android.view.View>))`(Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`> childMatcher) ` Returns`true`only if the view's child is accepted by the provided matcher.                                                                                                                                                                                                                          |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withClassName](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withClassName(org.hamcrest.Matcher<java.lang.String>))`(Matcher<`[String](https://developer.android.com/reference/java/lang/String.html)`> classNameMatcher) ` Returns a matcher that matches Views with class name matching the given matcher.                                                                                                                                                                                                        |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withContentDescription](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withContentDescription(int))`(int resourceId) ` Returns a[`Matcher`](http://hamcrest.org/JavaHamcrest/javadoc/1.3/org/hamcrest/Matcher.html)that matches[Views](https://developer.android.com/reference/android/view/View.html)based on content description property value.                                                                                                                                                                   |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withContentDescription](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withContentDescription(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String.html)` text) ` Returns an[`Matcher`](http://hamcrest.org/JavaHamcrest/javadoc/1.3/org/hamcrest/Matcher.html)that matches[Views](https://developer.android.com/reference/android/view/View.html)based on content description property value.                                                                                     |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withContentDescription](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withContentDescription(org.hamcrest.Matcher<? extends java.lang.CharSequence>))`(Matcher<? extends `[CharSequence](https://developer.android.com/reference/java/lang/CharSequence.html)`> charSequenceMatcher) ` Returns an[`Matcher`](http://hamcrest.org/JavaHamcrest/javadoc/1.3/org/hamcrest/Matcher.html)that matches[Views](https://developer.android.com/reference/android/view/View.html)based on content description property value. |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withEffectiveVisibility](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withEffectiveVisibility(android.support.test.espresso.matcher.ViewMatchers.Visibility))`(`[ViewMatchers.Visibility](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers.Visibility)` visibility) ` Returns a matcher that matches[Views](https://developer.android.com/reference/android/view/View.html)that have "effective" visibility set to the given value.                                      |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withHint](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withHint(org.hamcrest.Matcher<java.lang.String>))`(Matcher<`[String](https://developer.android.com/reference/java/lang/String.html)`> stringMatcher) ` Returns a matcher that matches[TextView](https://developer.android.com/reference/android/widget/TextView.html)s based on hint property value.                                                                                                                                                        |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withHint](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withHint(int))`(int resourceId) ` Returns a matcher that matches a descendant of[TextView](https://developer.android.com/reference/android/widget/TextView.html)that is displaying the hint associated with the given resource id.                                                                                                                                                                                                                          |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withHint](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withHint(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String.html)` hintText) ` Returns a matcher that matches[TextView](https://developer.android.com/reference/android/widget/TextView.html)based on it's hint property value.                                                                                                                                                                                         |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withId](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withId(org.hamcrest.Matcher<java.lang.Integer>))`(Matcher<`[Integer](https://developer.android.com/reference/java/lang/Integer.html)`> integerMatcher) ` Returns a matcher that matches[View](https://developer.android.com/reference/android/view/View.html)s based on resource ids.                                                                                                                                                                         |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withId](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withId(int))`(int id) ` A matcher that matches[View](https://developer.android.com/reference/android/view/View.html)s based on its resource id.                                                                                                                                                                                                                                                                                                               |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withInputType](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withInputType(int))`(int inputType) ` Returns a matcher that matches[InputType](https://developer.android.com/reference/android/text/InputType.html).                                                                                                                                                                                                                                                                                                  |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withParent](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withParent(org.hamcrest.Matcher<android.view.View>))`(Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`> parentMatcher) ` A matcher that accepts a view if and only if the view's parent is accepted by the provided matcher.                                                                                                                                                                                              |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withParentIndex](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withParentIndex(int))`(int index) ` Returns a matcher that matches the child index inside the[ViewParent](https://developer.android.com/reference/android/view/ViewParent.html).                                                                                                                                                                                                                                                                     |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withResourceName](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withResourceName(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String.html)` name) ` Returns a matcher that matches[View](https://developer.android.com/reference/android/view/View.html)s based on resource id names, (for instance, channel_avatar).                                                                                                                                                            |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withResourceName](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withResourceName(org.hamcrest.Matcher<java.lang.String>))`(Matcher<`[String](https://developer.android.com/reference/java/lang/String.html)`> stringMatcher) ` Returns a matcher that matches[View](https://developer.android.com/reference/android/view/View.html)s based on resource id names, (for instance, channel_avatar).                                                                                                                    |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withSpinnerText](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withSpinnerText(int))`(int resourceId) ` Returns a matcher that matches a descendant of[Spinner](https://developer.android.com/reference/android/widget/Spinner.html)that is displaying the string of the selected item associated with the given resource id.                                                                                                                                                                                       |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withSpinnerText](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withSpinnerText(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String.html)` text) ` Returns a matcher that matches[Spinner](https://developer.android.com/reference/android/widget/Spinner.html)based on it's selected item's`toString`value.                                                                                                                                                                      |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withSpinnerText](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withSpinnerText(org.hamcrest.Matcher<java.lang.String>))`(Matcher<`[String](https://developer.android.com/reference/java/lang/String.html)`> stringMatcher) ` Returns a matcher that matches[Spinner's](https://developer.android.com/reference/android/widget/Spinner.html)based on`toString`value of the selected item.                                                                                                                            |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withSubstring](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withSubstring(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String.html)` substring) ` Returns a matcher that matches[TextView](https://developer.android.com/reference/android/widget/TextView.html)that contains the specific substring.                                                                                                                                                                           |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withTagKey](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withTagKey(int))`(int key) ` Returns a matcher that matches[View](https://developer.android.com/reference/android/view/View.html)based on tag keys.                                                                                                                                                                                                                                                                                                       |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withTagKey](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withTagKey(int, org.hamcrest.Matcher<java.lang.Object>))`(int key, Matcher<`[Object](https://developer.android.com/reference/java/lang/Object.html)`> objectMatcher) ` Returns a matcher that matches[View](https://developer.android.com/reference/android/view/View.html)s based on tag keys.                                                                                                                                                           |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withTagValue](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withTagValue(org.hamcrest.Matcher<java.lang.Object>))`(Matcher<`[Object](https://developer.android.com/reference/java/lang/Object.html)`> tagValueMatcher) ` Returns a matcher that matches[Views](https://developer.android.com/reference/android/view/View.html)based on tag property values.                                                                                                                                                         |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withText](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withText(org.hamcrest.Matcher<java.lang.String>))`(Matcher<`[String](https://developer.android.com/reference/java/lang/String.html)`> stringMatcher) ` Returns a matcher that matches[TextView](https://developer.android.com/reference/android/widget/TextView.html)s based on text property value.                                                                                                                                                        |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withText](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withText(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String.html)` text) ` Returns a matcher that matches[TextView](https://developer.android.com/reference/android/widget/TextView.html)based on its text property value.                                                                                                                                                                                              |
| ` static Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | ` `[withText](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#withText(int))`(int resourceId) ` Returns a matcher that matches a descendant of[TextView](https://developer.android.com/reference/android/widget/TextView.html)that is displaying the string associated with the given resource id.                                                                                                                                                                                                                        |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#)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() `                                                                                 | ||

## Public methods

### assertThat

```
void assertThat (String message, 
                T actual, 
                Matcher<T> matcher)
```

A replacement for MatcherAssert.assertThat that renders View objects nicely.

<br />

|                               Parameters                               ||
|-----------|-------------------------------------------------------------|
| `message` | `String`: the message to display. <br />                    |
| `actual`  | `T`: the actual value. <br />                               |
| `matcher` | `Matcher`: a matcher that accepts or rejects actual. <br /> |

### assertThat

```
void assertThat (T actual, 
                Matcher<T> matcher)
```

A replacement for MatcherAssert.assertThat that renders View objects nicely.

<br />

|                               Parameters                               ||
|-----------|-------------------------------------------------------------|
| `actual`  | `T`: the actual value. <br />                               |
| `matcher` | `Matcher`: a matcher that accepts or rejects actual. <br /> |

### hasBackground

```
Matcher<View> hasBackground (int drawableId)
```

Returns a matcher that matches[View](https://developer.android.com/reference/android/view/View.html)based on background resource.

Note: This method compares images at a pixel level and might have significant performance implications for larger bitmaps.

**This API is currently in beta.**

<br />

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

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### hasChildCount

```
Matcher<View> hasChildCount (int childCount)
```

Matches a[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html)if it has exactly the specified number of children.

<br />

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

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### hasContentDescription

```
Matcher<View> hasContentDescription ()
```

Returns an[`Matcher`](http://hamcrest.org/JavaHamcrest/javadoc/1.3/org/hamcrest/Matcher.html)that matches[Views](https://developer.android.com/reference/android/view/View.html)with any content description.

<br />

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### hasDescendant

```
Matcher<View> hasDescendant (Matcher<View> descendantMatcher)
```

Returns a matcher that matches[Views](https://developer.android.com/reference/android/view/View.html)based on the presence of a descendant in its view hierarchy.

<br />

|                                  Parameters                                   ||
|---------------------|----------------------------------------------------------|
| `descendantMatcher` | `Matcher`: the type of the descendant to match on <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### hasErrorText

```
Matcher<View> hasErrorText (String expectedError)
```

Returns a matcher that matches[EditText](https://developer.android.com/reference/android/widget/EditText.html)based on edit text error string value.

Note: Sugar for`hasErrorText(is("string"))`.

<br />

|            Parameters            ||
|-----------------|-----------------|
| `expectedError` | `String` <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### hasErrorText

```
Matcher<View> hasErrorText (Matcher<String> stringMatcher)
```

Returns a matcher that matches[EditText](https://developer.android.com/reference/android/widget/EditText.html)based on edit text error string value.

**Note:** View's error property can be`null`, to match against it use`
hasErrorText(nullValue(String.class)`

<br />

|            Parameters             ||
|-----------------|------------------|
| `stringMatcher` | `Matcher` <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### hasFocus

```
Matcher<View> hasFocus ()
```

Returns a matcher that matches[Views](https://developer.android.com/reference/android/view/View.html)currently have focus.

<br />

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### hasImeAction

```
Matcher<View> hasImeAction (int imeAction)
```

Returns a matcher that matches views that support input methods (e.g. EditText) and have the specified IME action set in its[EditorInfo](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html).

<br />

|                     Parameters                     ||
|-------------|---------------------------------------|
| `imeAction` | `int`: the IME action to match <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### hasImeAction

```
Matcher<View> hasImeAction (Matcher<Integer> imeActionMatcher)
```

Returns a matcher that matches views that support input methods (e.g. EditText) and have the specified IME action set in its[EditorInfo](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html).

<br />

|                             Parameters                             ||
|--------------------|------------------------------------------------|
| `imeActionMatcher` | `Matcher`: a matcher for the IME action <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### hasLinks

```
Matcher<View> hasLinks ()
```

Returns a matcher that matches[TextViews](https://developer.android.com/reference/android/widget/TextView.html)that have links.

<br />

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### hasMinimumChildCount

```
Matcher<View> hasMinimumChildCount (int minChildCount)
```

Matches a[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html)if it has at least the specified number of children.

<br />

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

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### hasSibling

```
Matcher<View> hasSibling (Matcher<View> siblingMatcher)
```

Returns an[`Matcher`](http://hamcrest.org/JavaHamcrest/javadoc/1.3/org/hamcrest/Matcher.html)that matches[Views](https://developer.android.com/reference/android/view/View.html)based on their siblings.

This may be particularly useful when a view cannot be uniquely selected on properties such as text or`R.id`. For example: a call button is repeated several times in a contacts layout and the only way to differentiate the call button view is by what appears next to it (e.g. the unique name of the contact).

<br />

|                                                                      Parameters                                                                       ||
|------------------|-------------------------------------------------------------------------------------------------------------------------------------|
| `siblingMatcher` | `Matcher`: a[`Matcher `](http://hamcrest.org/JavaHamcrest/javadoc/1.3/org/hamcrest/Matcher.html)for the sibling of the view. <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### hasTextColor

```
Matcher<View> hasTextColor (int colorResId)
```

Returns a matcher that matches[TextView](https://developer.android.com/reference/android/widget/TextView.html)based on it's color.

**This API is currently in beta.**

<br />

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

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### isAssignableFrom

```
Matcher<View> isAssignableFrom (Class<? extends View> clazz)
```

Matches[Views](https://developer.android.com/reference/android/view/View.html)based on instance or subclass of the provided class.

Some versions of Hamcrest make the generic typing of this a nightmare, so we have a special case for our users.

<br />

|       Parameters        ||
|---------|----------------|
| `clazz` | `Class` <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### isChecked

```
Matcher<View> isChecked ()
```

Returns a matcher that accepts if and only if the view is a CompoundButton (or subtype of) and is in checked state.

<br />

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### isClickable

```
Matcher<View> isClickable ()
```

Returns a matcher that matches[Views](https://developer.android.com/reference/android/view/View.html)that are clickable.

<br />

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### isCompletelyDisplayed

```
Matcher<View> isCompletelyDisplayed ()
```

Returns a matcher which only accepts a view whose height and width fit perfectly within the currently displayed region of this view.

There exist views (such as ScrollViews) whose height and width are larger then the physical device screen by design. Such views will**never**be completely displayed.

<br />

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### isDescendantOfA

```
Matcher<View> isDescendantOfA (Matcher<View> ancestorMatcher)
```

Returns a matcher that matches[Views](https://developer.android.com/reference/android/view/View.html)based on the given ancestor type.

<br />

|                                Parameters                                 ||
|-------------------|--------------------------------------------------------|
| `ancestorMatcher` | `Matcher`: the type of the ancestor to match on <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### isDisplayed

```
Matcher<View> isDisplayed ()
```

Returns a matcher that matches[Views](https://developer.android.com/reference/android/view/View.html)that are currently displayed on the screen to the user.

**Note:** isDisplayed will select views that are partially displayed (eg: the full height/width of the view is greater than the height/width of the visible rectangle). If you wish to ensure the entire rectangle this view draws is displayed to the user use[isCompletelyDisplayed()](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#isCompletelyDisplayed()).

<br />

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### isDisplayingAtLeast

```
Matcher<View> isDisplayingAtLeast (int areaPercentage)
```

Returns a matcher which accepts a view so long as a given percentage of that view's area is not obscured by any parent view and is thus visible to the user.

<br />

|                                                                               Parameters                                                                                ||
|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
| `areaPercentage` | `int`: an integer ranging from (0, 100\] indicating how much percent of the surface area of the view must be shown to the user to be accepted. <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### isEnabled

```
Matcher<View> isEnabled ()
```

Returns a matcher that matches[Views](https://developer.android.com/reference/android/view/View.html)that are enabled.

<br />

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### isFocusable

```
Matcher<View> isFocusable ()
```

Returns a matcher that matches[Views](https://developer.android.com/reference/android/view/View.html)that are focusable.

<br />

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### isJavascriptEnabled

```
Matcher<View> isJavascriptEnabled ()
```

Returns a matcher that matches[WebView](https://developer.android.com/reference/android/webkit/WebView.html)if they are evaluating`JavaScript`.

<br />

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### isNotChecked

```
Matcher<View> isNotChecked ()
```

Returns a matcher that accepts if and only if the view is a CompoundButton (or subtype of) and is not in checked state.

<br />

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### isRoot

```
Matcher<View> isRoot ()
```

Returns a matcher that matches root[View](https://developer.android.com/reference/android/view/View.html).

<br />

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### isSelected

```
Matcher<View> isSelected ()
```

Returns a matcher that matches[Views](https://developer.android.com/reference/android/view/View.html)that are selected.

<br />

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### supportsInputMethods

```
Matcher<View> supportsInputMethods ()
```

Returns a matcher that matches views that support input methods.

<br />

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withAlpha

```
Matcher<View> withAlpha (float alpha)
```

Matches[Views](https://developer.android.com/reference/android/view/View.html)with the specified alpha value.

<br />

|       Parameters        ||
|---------|----------------|
| `alpha` | `float` <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withChild

```
Matcher<View> withChild (Matcher<View> childMatcher)
```

Returns`true`only if the view's child is accepted by the provided matcher.

<br />

|                                 Parameters                                 ||
|----------------|------------------------------------------------------------|
| `childMatcher` | `Matcher`: the matcher to apply on the child views. <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withClassName

```
Matcher<View> withClassName (Matcher<String> classNameMatcher)
```

Returns a matcher that matches Views with class name matching the given matcher.

<br />

|              Parameters              ||
|--------------------|------------------|
| `classNameMatcher` | `Matcher` <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withContentDescription

```
Matcher<View> withContentDescription (int resourceId)
```

Returns a[`Matcher`](http://hamcrest.org/JavaHamcrest/javadoc/1.3/org/hamcrest/Matcher.html)that matches[Views](https://developer.android.com/reference/android/view/View.html)based on content description property value.

<br />

|                                     Parameters                                      ||
|--------------|-----------------------------------------------------------------------|
| `resourceId` | `int`: the resource id of the content description to match on. <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withContentDescription

```
Matcher<View> withContentDescription (String text)
```

Returns an[`Matcher`](http://hamcrest.org/JavaHamcrest/javadoc/1.3/org/hamcrest/Matcher.html)that matches[Views](https://developer.android.com/reference/android/view/View.html)based on content description property value. Sugar for`withContentDescription(is("string"))`.

<br />

|                   Parameters                   ||
|--------|----------------------------------------|
| `text` | `String`: the text to match on. <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withContentDescription

```
Matcher<View> withContentDescription (Matcher<? extends CharSequence> charSequenceMatcher)
```

Returns an[`Matcher`](http://hamcrest.org/JavaHamcrest/javadoc/1.3/org/hamcrest/Matcher.html)that matches[Views](https://developer.android.com/reference/android/view/View.html)based on content description property value.

<br />

|                                                                                                                  Parameters                                                                                                                  ||
|-----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `charSequenceMatcher` | `Matcher`: a[CharSequence](https://developer.android.com/reference/java/lang/CharSequence.html)[`Matcher `](http://hamcrest.org/JavaHamcrest/javadoc/1.3/org/hamcrest/Matcher.html)for the content description <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withEffectiveVisibility

```
Matcher<View> withEffectiveVisibility (ViewMatchers.Visibility visibility)
```

Returns a matcher that matches[Views](https://developer.android.com/reference/android/view/View.html)that have "effective" visibility set to the given value.

Effective visibility takes into account not only the view's visibility value, but also that of its ancestors. In case of[ERROR(/View.VISIBLE)](https://developer.android.com/), this means that the view and all of its ancestors have`visibility=VISIBLE`. In case of GONE and INVISIBLE, it's the opposite - any GONE or INVISIBLE parent will make all of its children have their effective visibility.

**Note:** Contrary to what the name may imply, view visibility does not directly translate into whether the view is displayed on screen (use[isDisplayed()](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#isDisplayed())for that). For example, the view and all of its ancestors can have`visibility=VISIBLE`, but the view may need to be scrolled to in order to be actually visible to the user. Unless you're specifically targeting the visibility value with your test, use[isDisplayed()](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers#isDisplayed()).

<br />

|                   Parameters                   ||
|--------------|----------------------------------|
| `visibility` | `ViewMatchers.Visibility` <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withHint

```
Matcher<View> withHint (Matcher<String> stringMatcher)
```

Returns a matcher that matches[TextView](https://developer.android.com/reference/android/widget/TextView.html)s based on hint property value.

**Note:** View's hint property can be`null`, to match against it use`
withHint(nullValue(String.class)`

<br />

|                                                                                                    Parameters                                                                                                     ||
|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `stringMatcher` | `Matcher`:[`Matcher `](http://hamcrest.org/JavaHamcrest/javadoc/1.3/org/hamcrest/Matcher.html)of[String](https://developer.android.com/reference/java/lang/String.html)with text to match <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withHint

```
Matcher<View> withHint (int resourceId)
```

Returns a matcher that matches a descendant of[TextView](https://developer.android.com/reference/android/widget/TextView.html)that is displaying the hint associated with the given resource id.

<br />

|                                          Parameters                                          ||
|--------------|--------------------------------------------------------------------------------|
| `resourceId` | `int`: the string resource the text view is expected to have as a hint. <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withHint

```
Matcher<View> withHint (String hintText)
```

Returns a matcher that matches[TextView](https://developer.android.com/reference/android/widget/TextView.html)based on it's hint property value.

**Note:** View's sugar for`withHint(is("string"))`.

<br />

|                                                           Parameters                                                           ||
|------------|--------------------------------------------------------------------------------------------------------------------|
| `hintText` | `String`:[String](https://developer.android.com/reference/java/lang/String.html)with the hint text to match <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withId

```
Matcher<View> withId (Matcher<Integer> integerMatcher)
```

Returns a matcher that matches[View](https://developer.android.com/reference/android/view/View.html)s based on resource ids. Note: Android resource ids are not guaranteed to be unique. You may have to pair this matcher with another one to guarantee a unique view selection.

<br />

|                           Parameters                           ||
|------------------|----------------------------------------------|
| `integerMatcher` | `Matcher`: a Matcher for resource ids <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withId

```
Matcher<View> withId (int id)
```

A matcher that matches[View](https://developer.android.com/reference/android/view/View.html)s based on its resource id.

Same as`withId(is(int))`but attempts to look up resource name of the given id and use a`R.id.myView`style description with describeTo. If resource lookup is unavailable, at the time describeTo is invoked, this will print out a simple "with id: %d". If the lookup for a given id fails, "with id: %d (resource name not found)" will be returned as the description.

**Note:**Android resource ids are not guaranteed to be unique. You may have to pair this matcher with another one to guarantee a unique view selection.

<br />

|              Parameters              ||
|------|--------------------------------|
| `id` | `int`: the resource id. <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withInputType

```
Matcher<View> withInputType (int inputType)
```

Returns a matcher that matches[InputType](https://developer.android.com/reference/android/text/InputType.html).

<br />

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

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withParent

```
Matcher<View> withParent (Matcher<View> parentMatcher)
```

A matcher that accepts a view if and only if the view's parent is accepted by the provided matcher.

<br />

|                              Parameters                               ||
|-----------------|------------------------------------------------------|
| `parentMatcher` | `Matcher`: the matcher to apply on getParent. <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withParentIndex

```
Matcher<View> withParentIndex (int index)
```

Returns a matcher that matches the child index inside the[ViewParent](https://developer.android.com/reference/android/view/ViewParent.html).

<br />

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

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withResourceName

```
Matcher<View> withResourceName (String name)
```

Returns a matcher that matches[View](https://developer.android.com/reference/android/view/View.html)s based on resource id names, (for instance, channel_avatar).

<br />

|                  Parameters                   ||
|--------|---------------------------------------|
| `name` | `String`: the resource id name <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withResourceName

```
Matcher<View> withResourceName (Matcher<String> stringMatcher)
```

Returns a matcher that matches[View](https://developer.android.com/reference/android/view/View.html)s based on resource id names, (for instance, channel_avatar).

<br />

|                             Parameters                             ||
|-----------------|---------------------------------------------------|
| `stringMatcher` | `Matcher`: a Matcher for resource id names <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withSpinnerText

```
Matcher<View> withSpinnerText (int resourceId)
```

Returns a matcher that matches a descendant of[Spinner](https://developer.android.com/reference/android/widget/Spinner.html)that is displaying the string of the selected item associated with the given resource id.

<br />

|                                              Parameters                                               ||
|--------------|-----------------------------------------------------------------------------------------|
| `resourceId` | `int`: the resource id of the string resource the text view is expected to hold. <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withSpinnerText

```
Matcher<View> withSpinnerText (String text)
```

Returns a matcher that matches[Spinner](https://developer.android.com/reference/android/widget/Spinner.html)based on it's selected item's`toString`value.

Note: Sugar for`withSpinnerText(is("string"))`.

<br />

|       Parameters        ||
|--------|-----------------|
| `text` | `String` <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withSpinnerText

```
Matcher<View> withSpinnerText (Matcher<String> stringMatcher)
```

Returns a matcher that matches[Spinner's](https://developer.android.com/reference/android/widget/Spinner.html)based on`toString`value of the selected item.

<br />

|                                                                                                     Parameters                                                                                                     ||
|-----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `stringMatcher` | `Matcher`:[`Matcher `](http://hamcrest.org/JavaHamcrest/javadoc/1.3/org/hamcrest/Matcher.html)of[String](https://developer.android.com/reference/java/lang/String.html)with text to match. <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withSubstring

```
Matcher<View> withSubstring (String substring)
```

Returns a matcher that matches[TextView](https://developer.android.com/reference/android/widget/TextView.html)that contains the specific substring.

**Note:** View's sugar for`withText(containsString("string"))`.

<br />

|                                                              Parameters                                                              ||
|-------------|-------------------------------------------------------------------------------------------------------------------------|
| `substring` | `String`:[String](https://developer.android.com/reference/java/lang/String.html)that is expected to be contained <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withTagKey

```
Matcher<View> withTagKey (int key)
```

Returns a matcher that matches[View](https://developer.android.com/reference/android/view/View.html)based on tag keys.

<br />

|          Parameters           ||
|-------|------------------------|
| `key` | `int`: to match <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withTagKey

```
Matcher<View> withTagKey (int key, 
                Matcher<Object> objectMatcher)
```

Returns a matcher that matches[View](https://developer.android.com/reference/android/view/View.html)s based on tag keys.

<br />

|                     Parameters                     ||
|-----------------|-----------------------------------|
| `key`           | `int`: to match <br />            |
| `objectMatcher` | `Matcher`: Object to match <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withTagValue

```
Matcher<View> withTagValue (Matcher<Object> tagValueMatcher)
```

Returns a matcher that matches[Views](https://developer.android.com/reference/android/view/View.html)based on tag property values.

<br />

|                                    Parameters                                    ||
|-------------------|---------------------------------------------------------------|
| `tagValueMatcher` | `Matcher`: a Matcher for the view's tag property value <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withText

```
Matcher<View> withText (Matcher<String> stringMatcher)
```

Returns a matcher that matches[TextView](https://developer.android.com/reference/android/widget/TextView.html)s based on text property value.

**Note:** A View text property is never`null`. If you call[setText(CharSequence)](https://developer.android.com/reference/android/widget/TextView.html#setText(java.lang.CharSequence))with a`null`value it will still be "" (empty string). Do not use a null matcher.

<br />

|                                                                                                    Parameters                                                                                                     ||
|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `stringMatcher` | `Matcher`:[`Matcher `](http://hamcrest.org/JavaHamcrest/javadoc/1.3/org/hamcrest/Matcher.html)of[String](https://developer.android.com/reference/java/lang/String.html)with text to match <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withText

```
Matcher<View> withText (String text)
```

Returns a matcher that matches[TextView](https://developer.android.com/reference/android/widget/TextView.html)based on its text property value.

**Note:** View's sugar for`withText(is("string"))`.

<br />

|                                                      Parameters                                                       ||
|--------|---------------------------------------------------------------------------------------------------------------|
| `text` | `String`:[String](https://developer.android.com/reference/java/lang/String.html)with the text to match <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <br /> |

### withText

```
Matcher<View> withText (int resourceId)
```

Returns a matcher that matches a descendant of[TextView](https://developer.android.com/reference/android/widget/TextView.html)that is displaying the string associated with the given resource id.

<br />

|                                     Parameters                                     ||
|--------------|----------------------------------------------------------------------|
| `resourceId` | `int`: the string resource the text view is expected to hold. <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| `Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`>` | <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)